Submission #2939366


Source Code Expand

package main

import (
	"fmt"
	"strings"
)

// 2018-08-03T23:01:50+0800
// 2018-08-03T23:12:52+0800
func main() {
	var S string
	fmt.Scanf("%s", &S)
	n := len(S)
	for ; true; {
		S = strings.Replace(S, "WW", "W", -1)
		S = strings.Replace(S, "BB", "B", -1)
		if n == len(S) {
			break
		}
		n = len(S)
	}
	switch len(S) {
	case 1:
		fmt.Println(0)
	case 2:
		fmt.Println(1)
	default:
		fmt.Println(len(S) - 1)
	}
}

Submission Info

Submission Time
Task C - 1D Reversi
User zhanbei
Language Go (1.6)
Score 300
Code Size 443 Byte
Status AC
Exec Time 61 ms
Memory 2304 KB

Judge Result

Set Name sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
Set Name Test Cases
sample sample_01.txt, sample_02.txt, sample_03.txt
All alternate_01.txt, alternate_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, same_01.txt, same_02.txt, sample_01.txt, sample_02.txt, sample_03.txt, small_01.txt, small_02.txt, small_03.txt
Case Name Status Exec Time Memory
alternate_01.txt AC 56 ms 1280 KB
alternate_02.txt AC 56 ms 1280 KB
random_01.txt AC 60 ms 2304 KB
random_02.txt AC 61 ms 2304 KB
random_03.txt AC 60 ms 2304 KB
random_04.txt AC 61 ms 2176 KB
random_05.txt AC 60 ms 1920 KB
same_01.txt AC 59 ms 1536 KB
same_02.txt AC 59 ms 1536 KB
sample_01.txt AC 1 ms 640 KB
sample_02.txt AC 1 ms 640 KB
sample_03.txt AC 1 ms 640 KB
small_01.txt AC 1 ms 640 KB
small_02.txt AC 1 ms 640 KB
small_03.txt AC 1 ms 640 KB