← Home
For problem statement at 1000-1999/1200-1299/1270-1279/1271/problemB.txt this is a correct solution, but verifier at 1000-1999/1200-1299/1270-1279/1271/verifierB.go ends with case 6 failed: expected "55\n1 2 5 6 7 8 9 13 15 16 17 19 22 24 26 27 30 32 33 35 36 37 39 40 41 47 49 50 51 53 54 55 61 63 65 73 74 78 80 81 82 87 93 96 97 99 100 102 103 104 105 107 108 109 110" got "47\n2 3 6 8 11 16 21 22 23 24 25 26 29 30 31 32 36 40 43 45 50 54 57 59 67 69 71 74 75 77 78 79 80 82 83 85 89 91 95 96 100 101 102 104 108 110 111"
input:
112
BWBWBWWWWBWWBBBWWBBBWBBBBBWBWBBBWBBWWBBWWBWWWWBBBWWBBWWBWWWWBBBBBBWWWWWWBWBWWBBBWWBWWWBBWWWWBBWBWBBWBBWWWBBWWWBW
exit status 1 can you fix the verifier? ```go
package main

import (
	"bufio"
	"fmt"
	"os"
)

func attempt(s []byte, target byte) ([]int, bool) {
	a := make([]byte, len(s))
	copy(a, s)
	ops := []int{}
	for i := 0; i < len(a)-1; i++ {
		if a[i] != target {
			if a[i] == 'B' {
				a[i] = 'W'
			} else {
				a[i] = 'B'
			}
			if a[i+1] == 'B' {
				a[i+1] = 'W'
			} else {
				a[i+1] = 'B'
			}
			ops = append(ops, i+1)
		}
	}
	if a[len(a)-1] == target {
		return ops, true
	}
	return nil, false
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var n int
	var s string
	if _, err := fmt.Fscan(in, &n); err != nil {
		return
	}
	if _, err := fmt.Fscan(in, &s); err != nil {
		return
	}

	bs := []byte(s)

	if ops, ok := attempt(bs, 'B'); ok {
		fmt.Fprintln(out, len(ops))
		if len(ops) > 0 {
			for i, p := range ops {
				if i > 0 {
					fmt.Fprint(out, " ")
				}
				fmt.Fprint(out, p)
			}
			fmt.Fprintln(out)
		} else {
			fmt.Fprintln(out)
		}
		return
	}
	if ops, ok := attempt(bs, 'W'); ok {
		fmt.Fprintln(out, len(ops))
		if len(ops) > 0 {
			for i, p := range ops {
				if i > 0 {
					fmt.Fprint(out, " ")
				}
				fmt.Fprint(out, p)
			}
			fmt.Fprintln(out)
		} else {
			fmt.Fprintln(out)
		}
		return
	}
	fmt.Fprintln(out, -1)
}
```