← Home
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)
}