Recently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized a × b squares, and each square is colored white or black. There are integers to the left of the rows and to the top of the columns, encrypting the corresponding row or column. The number of integers represents how many groups of black squares there are in corresponding row or column, and the integers themselves represents the number of consecutive black squares in corresponding group (you can find more detailed explanation in Wikipedia https://en.wikipedia.org/wiki/Japanese_crossword).

Adaltik decided that the general case of japanese crossword is too complicated and drew a row consisting of n squares (e.g. japanese crossword sized 1 × n), which he wants to encrypt in the same way as in japanese crossword. [Image] The example of encrypting of a single row of japanese crossword. 

Help Adaltik find the numbers encrypting the row he drew.


-----Input-----

The first line of the input contains a single integer n (1 ≤ n ≤ 100) — the length of the row. The second line of the input contains a single string consisting of n characters 'B' or 'W', ('B' corresponds to black square, 'W' — to white square in the row that Adaltik drew).


-----Output-----

The first line should contain a single integer k — the number of integers encrypting the row, e.g. the number of groups of black squares in the row.

The second line should contain k integers, encrypting the row, e.g. corresponding to sizes of groups of consecutive black squares in the order from left to right.


-----Examples-----
Input
3
BBW

Output
1
2 
Input
5
BWBWB

Output
3
1 1 1 
Input
4
WWWW

Output
0

Input
4
BBBB

Output
1
4 
Input
13
WBBBBWWBWBBBW

Output
3
4 1 3 


-----Note-----

The last sample case correspond to the picture in the statement.

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
input()
islands = [len(s) for s in input().split('W') if s]
print(len(islands))
print(*islands)


n = int(input())
s = input()
g = 0
aux = 0
l = []
for c in s:
	if c == 'B':
		aux += 1
	else:
		if aux > 0:
			g += 1
			l.append(str(aux))
		aux = 0
if aux != 0:
	g += 1
	l.append(str(aux))
print(g)
print(' '.join(l))


input()
s = list(map(str, input().split('W')))
print(len(s) - s.count(''))
for i in range(len(s)):
	if s[i].count('B') != 0:
		print(s[i].count('B'), end=' ')


n = int(input())
a = list(map(str, input().split('W')))
l = len(a)
print(l - a.count(''))
for i in a:
	if i != '':
		print(len(i), end=' ')
	else:
		continue


n = input()
s = input()

def jap_cross(s):
	res = []
	while True:
		start = s.find('B')
		if start == -1:
			return res
		else:
			s = s[start:]
			length = s.find('W')
			if length == -1:
				res.append(len(s))
				return res
			else:
				res.append(length)
				s = s[length:]
res = jap_cross(s)
print(len(res))
for x in res:
	print(x, end=' ')


a = int(input())
b = input()
k = 0
S = [0] * (len(b) + 1)
L = []
for i in b:
	if k == 0 and i == 'W':
		continue
	elif k == 0 and i == 'B':
		S[k + 1] = 1
		k = 1
	elif i == 'B':
		S[k] = S[k] + 1
	else:
		k = k + 1
k = 0
for i in S:
	if i != 0:
		L.append(i)
		k = k + 1
print(k)
for i in L:
	print(i, end=' ')


n = int(input())
c = 0
s = input()
ans = ''
ans_n = 0
for i in range(n):
	if s[i] == 'B':
		c += 1
	else:
		if c != 0:
			ans += str(c) + ' '
			ans_n += 1
		c = 0
if c != 0:
	ans += str(c) + ' '
	ans_n += 1
print(ans_n)
print(ans)


l = int(input())
str1 = input()
str1 = str1.replace('W', ' ').split()
print(len(str1))
for i in str1:
	print(len(i), end=' ')


n = int(input())
st = input()
l = len(st)
k = 0
kl = []
f = 0
for i in range(0, l):
	if st[i] == 'B':
		f += 1
	elif f != 0:
		kl.append(f)
		f = 0
		k += 1
if f != 0:
	k += 1
	kl.append(f)
print(k)
for _ in kl:
	print(_, end=' ')


I = int(input())
x = input().split('W')
m = []
for i in range(len(x)):
	if len(x[i]) != 0:
		m.append(len(x[i]))
print(len(m))
for i in range(len(m)):
	print(m[i])


def solve(s):
	count = 0
	b = list()
	for (i, c) in enumerate(s):
		if c == 'B':
			if count == 0:
				count += 1
			elif s[i - 1] == 'B':
				count += 1
		elif count > 0 and s[i - 1] == 'B':
			b.append(count)
			count = 0
	if count > 0 and s[len(s) - 1] == 'B':
		b.append(count)
	ans = [str(len(b)), ' '.join(map(str, b))]
	return '\n'.join(ans)

def main():
	n = int(input())
	s = input()
	print(solve(s))
main()


(n, s) = (int(input()), input())
s = 'W' + s + 'W'
(k, a) = (0, [])
for c in s:
	if c == 'B':
		k += 1
	if c == 'W' and k > 0:
		a.append(str(k))
		k = 0
print(len(a))
print(' '.join(a))


a = int(input())
b = input()
ans = []
for i in range(a):
	if i == 0:
		if b[i] == 'B':
			ans.append('1')
	elif b[i] == 'B' and b[i - 1] == 'W':
		ans.append('1')
	elif b[i] == 'B' and b[i - 1] == 'B':
		ans[-1] = str(int(ans[-1]) + 1)
print(len(ans))
print(' '.join(ans))


n = int(input())
s = input()
(num, b) = (0, 0)
a = []
for i in range(n):
	if s[i] == 'B' and i != n - 1:
		num += 1
	elif s[i] == 'B' and i == n - 1:
		b += 1
		num += 1
		a.append(num)
	elif num != 0 and s[i] != 'B':
		b += 1
		a.append(num)
		num = 0
print(b)
print(' '.join([str(s) for s in a]))


n = int(input())
arr = [x for x in input().split('W') if len(x) > 0]
print(len(arr))
ans = ''
for i in arr:
	ans += str(len(i)) + ' '
print(ans)


n = int(input())
s = input()
ans = []
l = []
c = 0
for i in range(n):
	if s[i] == 'B':
		c = c + 1
	else:
		if c != 0:
			ans.append(c)
		c = 0
if c != 0:
	ans.append(c)
if sum(ans) != 0:
	print(len(ans))
	print(*ans)
else:
	print(0)


n = int(input())
s = input()
s1 = ''
a = []
ret = []
t = cnt = 0
k = 0
for i in range(n):
	s1 += s[i]
s1 += 'W'
for i in range(n + 1):
	if s1[i] == 'B' and s1[i + 1] == 'W':
		cnt += 1
		a.append(i)
print(cnt)
for i in a:
	j = i
	t = 0
	if j == 0:
		t = 1
	while j > 0 and s[j] == 'B':
		t += 1
		j -= 1
		if j == 0 and s1[j] == 'B':
			t += 1
	print(t, end=' ')


n = int(input())
a = list(input().split('W'))
while '' in a:
	a.remove('')
print(len(a))
for i in a:
	print(len(i), end=' ')


n = int(input())
s = input()
count = 0
res = 0
prev = 'W'
a = []
for i in range(len(s)):
	if s[i] == 'B':
		if prev == 'B':
			res += 1
		else:
			prev = 'B'
			count += 1
			res = 1
	else:
		prev = 'W'
		if res > 0:
			a.append(res)
		res = 0
if res > 0:
	a.append(res)
print(count)
for each in a:
	print(each, end=' ')


n = int(input())
s = input()
a = []
c = 0
for i in s.split('W'):
	if i != '':
		a.append(len(i))
		c += 1
print(c)
print(*a)


n = int(input())
st = input()
st = st.strip('W')
arr = st.split('W')
lst = []
for i in arr:
	if i == '':
		arr.remove(i)
if arr == []:
	print(0)
else:
	for i in arr:
		if len(i) != 0:
			lst.append(i)
	print(len(lst))
	for i in lst:
		print(len(i), end=' ')


n = int(input())
s = input().split('W')
print(len(s) - s.count(''))
for i in s:
	if i:
		print(len(i), end=' ')


n = int(input())
s = input()
c = k = 0
l = []
for i in range(n):
	if s[i] == 'B':
		c += 1
		if i == n - 1:
			l.append(c)
			k += 1
	elif s[i] == 'W' and i != 0 and (c != 0):
		l.append(c)
		c = 0
		k += 1
if k == 0:
	print(0)
else:
	print(k)
	for i in l:
		print(i, end=' ')


a = int(input())
s = input()
cnt = 0
k = []
t = False
for i in s:
	if i == 'B':
		t = True
if t:
	for i in range(a):
		if s[i] == 'B':
			cnt += 1
		if (s[i] == 'W' or i == a - 1) and cnt != 0:
			k.append(cnt)
			cnt = 0
	print(len(k))
	for i in k:
		print(i, end=' ')
else:
	print(0)


b = []
n = int(input())
s = input()
now = 0
for i in s:
	if i == 'B':
		now += 1
	else:
		if now > 0:
			b.append(now)
		now = 0
if now > 0:
	b.append(now)
print(len(b))
print(*b)


import math
import os
import random
import re
import sys
import heapq
n = int(input())
arr = list(input())
num = []
total = 0
a = 0
while a < len(arr):
	if arr[a] == 'B':
		count = 0
		while a < len(arr) and arr[a] == 'B':
			count += 1
			a += 1
		num.append(str(count))
		total += 1
	a += 1
print(total)
print(' '.join(num))


n = int(input())
s = input()
ans = []
d = 0
for i in range(n):
	if s[i] == 'B':
		d += 1
		if i == n - 1:
			ans.append(d)
	elif d > 0:
		ans.append(d)
		d = 0
print(len(ans))
if len(ans) > 0:
	for i in ans:
		print(i, end=' ')


n = int(input())
s = input()
if 'B' not in s:
	print(0)
else:
	s = s.split('W')
	solution = list(map(len, filter(lambda x: len(x) > 0, s)))
	print(len(solution))
	print(' '.join(map(str, solution)))


n = int(input())
m = list(input())
c = 0
l = []
for i in range(n):
	if m[i] == 'B':
		c += 1
	if i == n - 1 and m[i] == 'B' or m[i] == 'W':
		l.append(c)
		c = 0
for i in range(l.count(0)):
	l.remove(0)
print(len(l))
print(*l)


n = int(input())
a = str(input())
l = len(a)
if a[0] == 'W':
	s = 0
else:
	s = 1
for i in range(1, n):
	if a[i - 1] == 'W' and a[i] == 'B':
		s = s + 1
print(int(s))
s = 0
for i in range(n):
	if a[i] == 'B':
		s = s + 1
	elif s != 0:
		print(int(s), end=' ')
		s = 0
if a[l - 1] == 'B':
	print(int(s))


n = int(input())
box = input()
groups_counter = tmp_counter = start = end = group = 0
groups = []
for i in range(n):
	if box[i] == 'B' and start == 0:
		start = 1
		tmp_counter += 1
	elif box[i] == 'B' and start:
		tmp_counter += 1
	elif box[i] == 'W' and start:
		start = 0
		groups.append(tmp_counter)
		groups_counter += 1
		tmp_counter = 0
if box[n - 1] == 'B' and start:
	groups_counter += 1
	groups.append(tmp_counter)
print(groups_counter)
print(*groups)


input()
list1 = input().split('W')
sum = 0
str1 = ''
for i in range(len(list1)):
	if len(list1[i]) > 0:
		str1 += str(len(list1[i])) + ' '
		sum += 1
print(sum)
print(str1)


length = int(input())
string = input()
ans = []
t = 0
for i in range(length):
	if string[i] == 'B':
		t += 1
	else:
		if t != 0:
			ans.append(t)
		t = 0
if t != 0:
	ans.append(t)
print(len(ans))
for i in ans:
	print(i, end=' ')


import sys
n = int(input())
string = input()
pre_white = 1
group = cnt = 0
black_group = []
for char in string:
	if char == 'W':
		pre_white = 1
		if cnt > 0:
			black_group.append(cnt)
		cnt = 0
	else:
		if pre_white == 1:
			group += 1
		cnt += 1
		pre_white = 0
if cnt > 0:
	black_group.append(cnt)
print(group)
if group > 0:
	print(*black_group, sep=' ')


n = int(input())
x = [str(x) for x in input()][:n]
count = 0
new = []
for i in range(n):
	if x[i] == 'B':
		count += 1
	elif count:
		new.append(count)
		count = 0
if count:
	new.append(count)
if len(new) == 0:
	print(0)
else:
	print(len(new))
	print(*new)


a = int(input())
b = input().split('W')
p = []
for i in b:
	i.strip('W')
	if len(i):
		p.append(len(i))
print(len(p))
if p:
	print(' '.join(map(str, p)))


n = int(input())
a = list(input())
ans = []
ans1 = 0
for i in range(n):
	if a[i] == 'B':
		ans1 += 1
	else:
		ans.append(ans1)
		ans1 = 0
ans.append(ans1)
print(len(ans) - ans.count(0))
for i in range(len(ans)):
	if ans[i] != 0:
		print(ans[i], end=' ')


n = int(input())
s = input()
counter = 1 if s[-1] == 'B' else 0
for i in range(n - 2, -1, -1):
	if s[i] == 'B' and s[i + 1] != 'B':
		counter += 1
m = s.split('W')
x = []
for j in m:
	if len(j) > 0:
		x.append(str(len(j)))
print(counter)
print(' '.join(x))


n = int(input())
a = input()
t = []
p = ''
if 'W' not in a:
	print(1)
	print(len(a))
else:
	for i in range(len(a)):
		if a[i] == 'B':
			p += a[i]
		elif a[i] == 'W':
			if len(p) > 0:
				t.append(len(p))
			p = ''
			O = i
	if len(a[O + 1:]) > 0:
		t.append(len(a[O + 1:]))
if 'W' in a:
	if sum(t) == 0:
		print(0)
	else:
		print(len(t))
		for j in t:
			print(j, end=' ')


a = input()
a = input()
b = []
current = 0
for el in a:
	if el == 'B':
		current += 1
	else:
		if current != 0:
			b.append(current)
		current = 0
if current != 0:
	b.append(current)
print(len(b))
for el in b:
	print(el, end=' ')


n = int(input())
s = input()
a = []
cur = 0
for i in s:
	if i == 'B':
		cur += 1
	elif cur:
		a.append(cur)
		cur = 0
if cur:
	a.append(cur)
print(len(a))
print(*a)


input()
ss = list(filter(lambda s: len(s) > 0, input().split('W')))
print(len(ss))
if len(ss) > 0:
	print(*[len(s) for s in ss])


m = int(input())
a = input().split('W')
a = list(filter(lambda x: x != '', a))
print(len(a))
for i in a:
	print(len(i), end=' ')


import re
n = int(input())
s = input()
ans = []
for i in re.findall('B+', s):
	ans.append(len(i))
print(len(ans))
print(*ans)


import sys
sys.stdin.readline().strip()
s = sys.stdin.readline().strip()
blacks = s.split('W')
res = [len(black) for black in blacks if len(black) > 0]
print(len(res))
print(' '.join(map(str, res)))


n = int(input())
s = input()
t = 0
ts = []
for c in s:
	if c == 'B':
		t += 1
	elif t > 0:
		ts.append(t)
		t = 0
if t > 0:
	ts.append(t)
	t = 0
print(len(ts))
print(str(' '.join((str(t) for t in ts))))


a = int(input())
b = str(input())
c = []
d = 0
e = 0
if 'B' not in b:
	print(0)
else:
	for i in b:
		if i == 'B':
			d += 1
		elif i == 'W':
			if d == 0:
				continue
			else:
				e += 1
				c.append(int(d))
				d = 0
	if d != 0:
		c.append(int(d))
	if b[-1] == 'B':
		e += 1
	print(e)
	print(' '.join(map(str, c)))


n = int(input())
s = input()
i = 0
c = 0
a = []
while i < len(s):
	if s[i] == 'B':
		c += 1
		j = i
		while j < len(s):
			if s[j] == 'W':
				break
			j += 1
		a.append(j - i)
		i = j
	else:
		i += 1
print(c)
if c != 0:
	for i in a:
		print(i, end=' ')


n = int(input())
a = input()
a = list(a)
count = 0
x = []
c = 0
i = 0
if n == 1 and a[0] == 'B':
	print(1)
	print(1)
else:
	while i < n:
		if a[i] == 'B' and i < n - 1:
			count += 1
			if a[i + 1] == 'W':
				c += 1
				x.append(count)
				count = 0
			if i == n - 2 and a[i + 1] == 'B':
				c += 1
				count += 1
				x.append(count)
				break
		if i == n - 1 and a[i] == 'B' and (a[i - 1] != 'B'):
			count += 1
			c += 1
			x.append(count)
			break
		i += 1
	print(c)
	for i in x:
		print(i, end=' ')


import sys, math, string
input = sys.stdin.readline
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split('W'))
M = lambda : map(int, input().split())
n = int(input())
l = input()
g = []
c = 0
for i in l:
	if i == 'B':
		c += 1
	else:
		if c > 0:
			g.append(c)
		c = 0
if l[-1] == 'B':
	g.append(c)
print(len(g))
print(*g)


def answer():
	n = int(input())
	c = input()
	ans = ''
	c_out = []
	if 'B' not in c:
		return 0
	elif 'W' not in c:
		i = 0
		return [len(c), 1]
	i = 0
	while i < len(c):
		targ = c[i]
		if c[i] == 'B':
			j = i
			temp = 0
			while j < len(c) and c[j] != 'W':
				temp += 1
				j += 1
				i = j
			if temp != 0:
				c_out.append(temp)
		i += 1
	i = 0
	while i < len(c_out):
		ans += str(c_out[i])
		if i != len(c_out) - 1:
			ans += ' '
		i += 1
	return [ans, len(c_out)]
c = answer()
if c == 0:
	print(0)
else:
	print(c[1])
	print(c[0])


n = int(input())
a = input()
s = 0
c = []
for i in range(n):
	if a[i] == 'B':
		s = s + 1
	elif s != 0:
		c.append(s)
		s = 0
if s != 0:
	c.append(s)
print(int(len(c)))
for i in c:
	print(i, end=' ')


n = int(input())
line = list(input())
i = 1
z = []
if line[0] == 'B':
	countb = 1
	count = 1
else:
	countb = 0
	count = 0
if n > 1:
	for i in range(1, n):
		if line[i] == 'B':
			if line[i - 1] == 'W':
				count += 1
				countb = 1
			else:
				countb += 1
				continue
		elif line[i - 1] == 'B':
			z.append(countb)
		else:
			continue
	if line[i] == 'B':
		z.append(countb)
elif line[0] == 'B':
	count = 1
	z.append(1)
else:
	count = 0
print(count)
print(*z, sep=' ')


import sys
n = int(input())
s = input()
outp = []
count = 0
flag = 0
total = 0
i = 0
while i < len(s) and s[i] == 'W':
	i += 1
if i == len(s):
	print(0)
	sys.exit()
while i < len(s):
	if s[i] == 'B':
		count += 1
		i += 1
	else:
		if count > 0:
			total += 1
			outp.append(count)
		count = 0
		i += 1
if s[-1] == 'B':
	total += 1
	outp.append(count)
print(total)
for i in range(total):
	print(outp[i], end=' ')


n = input()
row = input()
cur = 0
flag = False
res = []

def appendCur():
	global res
	global cur
	if cur > 0:
		res.append(str(cur))
for c in row:
	if c == 'W':
		flag = False
	elif flag == False:
		appendCur()
		flag = True
		cur = 1
	else:
		cur += 1
appendCur()
total = len(res)
print(total)
if total > 0:
	print(' '.join(res))


n = int(input())
s = input()
k = 0
mas = []
for i in range(n):
	if s[i] == 'B':
		k += 1
	else:
		if k > 0:
			mas.append(k)
		k = 0
if k > 0:
	mas.append(k)
print(len(mas))
for i in mas:
	print(i, end=' ')


n = int(input())
m = input()
x = 0
y = []
for i in m:
	if i == 'B':
		x += 1
	elif x != 0:
		y.append(x)
		x = 0
if x > 0:
	y.append(x)
if len(y) != 0:
	print(len(y))
if len(y) == 0:
	print(0)
for i in range(len(y)):
	if len(y) != 0:
		print(y[i], end=' ')


n = int(input())
s = input()
arr = []
start = 0
end = -1
for i in range(n):
	if s[i] == 'B':
		end = i
	if s[i] == 'W':
		if start <= end:
			arr.append(end - start + 1)
		start = i + 1
		end = i
if start <= end:
	arr.append(end - start + 1)
print(len(arr))
if len(arr) > 0:
	print(' '.join(map(str, arr)))


n = int(input())
a = input()
(c, v) = (0, [])
for i in a:
	if i == 'B':
		c += 1
	elif c != 0:
		v.append(c)
		c = 0
if c != 0:
	v.append(c)
print(len(v))
print(*v)


n = int(input())
s = input()
q = []
group = 0
summation = 0

def split(word):
	return [char for char in word]
s = split(s)
for i in range(n - 1):
	if s[i] == 'B' and s[i + 1] == 'W':
		summation += 1
for j in range(n):
	if s[j] == 'B':
		group += 1
	elif s[j] == 'W' and group > 0:
		q.append(group)
		group = 0
if s[n - 1] == 'B':
	summation += 1
	q.append(group)
print(summation)
if summation > 0:
	for i in q:
		print(i, end=' ')


n = int(input())
s = input()
a = []
for i in s.split('W'):
	if len(i) > 0:
		a += [str(len(i))]
print(len(a))
print(' '.join(a))


import sys
input = lambda : sys.stdin.readline()

def main():
	n = int(input())
	s = input()
	cnt = 0
	for i in range(n):
		if s[i] == 'W':
			cnt += 1
	if cnt == n:
		print(0)
		return 0
	b = 0
	g = 0
	A = []
	ind = 0
	for i in range(n):
		if s[i] == 'B':
			ind = i
			break
	for i in range(ind, n):
		if s[i] == 'B':
			b += 1
		if s[i] == 'W':
			if b != 0:
				A.append(b)
			b = 0
	if s[n - 1] == 'B':
		A.append(b)
	print(len(A))
	print(*A)
main()


a = input()
st = input()
ans = ''
count = 0
sum = 0
for i in range(len(st)):
	if st[i] == 'B':
		count += 1
	if st[i] == 'W':
		if count != 0:
			sum += 1
			ans += str(count) + ' '
			count = 0
if count != 0:
	sum += 1
	ans += str(count)
print(sum, '\n', ans)


n = int(input())
s = input()
li = []
count = 0
for i in range(n):
	if s[i] == 'B':
		count += 1
		if i == n - 1:
			li.append(count)
	elif count > 0:
		li.append(count)
		count = 0
count2 = 0
if s[0] == 'B':
	count2 += 1
for i in range(n - 1):
	if s[i] == 'W' and s[i + 1] == 'B':
		count2 += 1
print(count2)
for i in range(len(li)):
	print(li[i], end=' ')


n = int(input())
s = input()
a = 'W'
x = 0
y = 0
z = ''
for i in s:
	if i == 'W' and a == 'B':
		y += 1
		z += str(x) + ' '
		x = 0
		a = 'W'
	if i == 'B':
		a = 'B'
		x += 1
if x > 0:
	y += 1
	z += str(x)
print(y)
print(z)


n = int(input())
s = input() + 'W'
c = 0
m = 0
a = []
for i in range(n + 1):
	if s[i] == 'B':
		m += 1
	else:
		if m > 0:
			c += 1
			a.append(m)
		m = 0
print(c)
if len(a) > 0:
	print(*a, sep=' ')


n = int(input())
s = input()
k = 0
i = 0
a = []
while i < len(s):
	if s[i] == 'B':
		k += 1
		a.append(0)
	while i < len(s) and s[i] == 'B':
		i += 1
		a[k - 1] += 1
	i += 1
print(k)
if k > 0:
	print(' '.join(map(str, a)))


n = int(input())
mat = input()
lis = []
cnt = 0
last = False
for c in mat:
	if c == 'B':
		if not last:
			last = True
			cnt += 1
			lis.append(1)
		else:
			lis[-1] += 1
	else:
		last = False
print(cnt)
for k in lis:
	print(k, end=' ')
if cnt:
	print()


def main():
	x = int(input())
	y = input()
	f = 0
	final = []
	semafor = 0
	for i in range(0, x):
		if y[i] == 'B':
			if semafor == 0:
				f += 1
				semafor += 1
			else:
				semafor += 1
		elif semafor != 0:
			final.append(semafor)
			semafor = 0
		else:
			semafor = 0
	if semafor != 0:
		final.append(semafor)
	print(f)
	for i in range(0, len(final)):
		print(final[i], end=' ')
main()


import sys
fin = sys.stdin
fout = sys.stdout
n = int(fin.readline())
s = fin.readline()
found = False
count = 0
res = []
for i in range(len(s)):
	if s[i] == 'B':
		if not found:
			found = True
			count += 1
		else:
			count += 1
	elif found:
		found = False
		res.append(count)
		count = 0
if found:
	found = False
	res.append(count)
	count = 0
fout.write(str(len(res)) + '\n')
if len(res) > 0:
	fout.write(' '.join(map(str, res)))


n = int(input())
s = input()
count = 0
count_1 = 0
for i in range(len(s) - 1):
	if s[i] == 'B' and s[i + 1] == 'W':
		count += 1
if s[-1] == 'B':
	count += 1
print(count)
for i in range(len(s)):
	if s[i] == 'B':
		count_1 += 1
	else:
		if count_1 > 0:
			print(count_1, end=' ')
		count_1 = 0
if count_1 > 0:
	print(count_1)


import sys
n = int(sys.stdin.readline())
chars = list(sys.stdin.readline().strip())
count = 0
curSize = 0
sizes = []
for i in range(n):
	if chars[i] == 'B':
		curSize += 1
	elif chars[i] == 'W':
		if curSize != 0:
			count += 1
			sizes.append(curSize)
			curSize = 0
if curSize != 0:
	sizes.append(curSize)
	count += 1
print(count)
if count != 0:
	print(' '.join(map(str, sizes)))


m = int(input())
n = str(input())
a = n.split('W')
b = []
count = 0
for i in range(len(a)):
	if len(a[i]) != 0:
		b.append(len(a[i]))
		count += 1
print(count)
print(' '.join([str(x) for x in b]))


n = int(input())
s = input()
ans = []
cu = 0
i = 0
while i < n:
	if s[i] == 'B':
		while i < n and s[i] == 'B':
			i += 1
			cu += 1
		ans.append(cu)
		cu = 0
	else:
		i += 1
print(len(ans))
for i in ans:
	print(i)


_ = input()
s = input()
t = 0
l_t = list()
for c in s:
	if c == 'B':
		t += 1
	else:
		if t != 0:
			l_t.append(str(t))
		t = 0
if t != 0:
	l_t.append(str(t))
print(len(l_t))
print(' '.join(l_t))


n = int(input())
arr = input().split('W')
for i in range(arr.count('')):
	arr.remove('')
print(len(arr))
if len(arr):
	s = ''
	for x in arr:
		s += str(len(x)) + ' '
	print(s)


n = int(input())
s = input() + 'W'
j = 0
l = []
for i in range(n + 1):
	if s[i] == 'B':
		j += 1
		continue
	if j > 0:
		l.append(j)
		j = 0
print(len(l))
for i in l:
	print(i)


_ = input()
array = input()
groups = 0
size = ''
current = 0
for item in array:
	if item == 'B':
		if current == 0:
			groups += 1
		current += 1
	else:
		if current > 0:
			size += str(current) + ' '
		current = 0
if array[-1] == 'B':
	size += str(current)
if size:
	print(groups)
	print(size)
else:
	print(0)


n = int(input())
a = input()
b = list()
i = 0
while i < len(a):
	if a[i] == 'B':
		k = 0
		for j in range(i, len(a)):
			if a[j] == 'B':
				k += 1
			else:
				break
		b.append(k)
		i = j
	i += 1
print(len(b))
for i in range(len(b)):
	print(b[i], end=' ')


n = int(input())
a = list(input())
a.append('W')
b = 0
black = []
for i in range(n + 1):
	if a[i] == 'B':
		b += 1
	if a[i] == 'W' and i != 0 and (a[i - 1] == 'B'):
		black.append(b)
		b = 0
print(len(black))
for i in black:
	print(i, end=' ')


n = int(input())
S = input()
k = 0
k1 = 0
S1 = []
for x in S:
	if x == 'B':
		k1 = k1 + 1
	elif k1 != 0:
		S1.append(str(k1))
		k = k + 1
		k1 = 0
if k1 != 0:
	S1.append(str(k1))
	k = k + 1
print(k)
print(' '.join(S1))


input()
s = input()
(i, dem) = (0, 0)
ls = []
while i < len(s):
	if s[i] == 'B':
		dem += 1
	else:
		if dem != 0:
			ls.append(str(dem))
		dem = 0
	i += 1
if dem != 0:
	ls.append(str(dem))
print(len(ls), '\n', ' '.join(ls))


n = int(input())
s = input()
cnt = 0
a = []
flag = False
for i in range(n):
	if s[i] == 'B' and flag:
		cnt += 1
	if s[i] == 'B' and (not flag):
		cnt = 1
		flag = True
	if cnt != 0 and s[i] == 'W' or (i + 1 == n and cnt != 0):
		a.append(cnt)
		flag = False
		cnt = 0
print(len(a))
[print(x, end=' ') for x in a]


n = input()
s = input()
c = 0
a = []
for i in s:
	if i == 'B':
		c += 1
	elif c > 0:
		a.append(str(c))
		c = 0
if c > 0:
	a.append(str(c))
if len(a) == 0:
	print(0)
else:
	print(len(a))
	print(' '.join(a))


n = int(input())
grCount = 0
lans = ''
r = input()
i = 0
while i < n:
	if r[i] == 'B':
		leng = 0
		while i < n and r[i] == 'B':
			leng += 1
			i += 1
		lans += str(leng) + ' '
		grCount += 1
	i += 1
print(grCount)
print(lans)


n = input()
row = input().split('W')
k = 0
ls = []
for i in row:
	if 'B' in i:
		black = 0
		k += 1
		for countb in i:
			black += 1
		ls.append(black)
print(k)
for i in ls:
	print(i, end=' ')


def dfs(v):
	visited[v] = True
	size[k] += 1
	if v + 1 != n and (not visited[v + 1]) and (d[v + 1] == 'B'):
		dfs(v + 1)
n = int(input())
s = input()
d = list(s)
visited = [False] * n
size = []
k = 0
for i in range(n):
	if d[i] == 'B' and (not visited[i]):
		size.append(0)
		dfs(i)
		k += 1
print(len(size))
for ob in size:
	print(ob, end=' ')


c = int(input())
groups = []
stroke = input()
current = 0
for i in stroke:
	if i == 'B':
		current += 1
	else:
		if current != 0:
			groups += [current]
		current = 0
if current != 0:
	groups += [current]
print(len(groups))
print(' '.join((str(x) for x in groups)))


from sys import stdin
n = int(stdin.readline())
s = stdin.readline().rstrip()
c = 0
groups = []
for char in s:
	if char == 'B':
		c += 1
	elif c > 0:
		groups.append(c)
		c = 0
if s[-1] == 'B':
	groups.append(c)
print(len(groups))
for group in groups:
	print('{} '.format(group), end='')


n = int(input())
l = list(input())
if l.count('B') == 0:
	print('0')
else:
	b = 0
	c = 0
	l1 = []
	for i in range(0, len(l) - 1):
		if l[i] == 'B':
			b = b + 1
		if l[i] == 'B' and l[i + 1] == 'W':
			c = c + 1
			l1.append(b)
			b = 0
	if l[len(l) - 2] == 'W' and l[len(l) - 1] == 'B':
		c = c + 1
		l1.append(b + 1)
	elif l[len(l) - 2] == 'B' and l[len(l) - 1] == 'B':
		c = c + 1
		l1.append(b + 1)
	print(c)
	for i in l1:
		print(i, end=' ')


length = input()
cross = input()

def main(length, cross):
	encr = False
	encryptions = 0
	lista = []
	encrs = 0
	for i in cross:
		if i == 'B':
			if encr == False:
				encryptions += 1
				encr = True
			encrs += 1
		elif i == 'W':
			encr = False
			if encrs != 0:
				lista.append(encrs)
			encrs = 0
	if encrs != 0:
		lista.append(encrs)
	print(encryptions)
	for i in lista:
		print(i, end=' ')
	print('\n')
main(length, cross)


l = int(input())
s = input()
blck = []
p = 0
for alph in s:
	if alph == 'W':
		if p:
			blck.append(p)
		p = 0
	else:
		p += 1
if p:
	blck.append(p)
print(len(blck))
print(*blck)


input()
ba = []
t = 0
for c in input():
	if c == 'B':
		t += 1
	elif t > 0:
		ba.append(str(t))
		t = 0
if t > 0:
	ba.append(str(t))
print(str(len(ba)) + '\n' + ' '.join(ba))


n = int(input())
s = input()
res = []
c = -1
k = 0
while k < n:
	if s[k] == 'B':
		res.append(0)
		c += 1
	while s[k] == 'B':
		res[c] += 1
		k += 1
		if k == n:
			break
	k += 1
s = ''
for i in res:
	s += str(i) + ' '
print(c + 1)
print(s)


n = int(input())
s = input().strip().split('W')
pre_ans = 0
ans = []
for k in s:
	if k != '':
		pre_ans += 1
		ans.append(k.count('B'))
print(pre_ans)
print(*ans)


n = int(input())
s = input()
cur = 0
a = []
for elem in s:
	if elem == 'B':
		cur += 1
	elif cur != 0:
		a.append(cur)
		cur = 0
if cur != 0:
	a.append(cur)
print(len(a))
print(' '.join(map(str, a)))


n = int(input().strip())
s = input().strip()
blocks = s.split('W')
block_lenghts = [str(len(b)) for b in blocks if b]
if block_lenghts:
	print(len(block_lenghts))
	print(' '.join(block_lenghts))
else:
	print(0)


import math
import sys
n = input()
a = input()
n = int(n)
b = [0 for i in range(100000)]
hmc = 0
count = 0
for i in range(n - 1):
	if a[i] == 'B':
		count += 1
	if a[i] == 'B' and a[i + 1] == 'W':
		b[hmc] = count
		hmc += 1
		count = 0
if a[n - 1] == 'B':
	hmc += 1
print(hmc)
if a[n - 1] == 'B':
	b[hmc - 1] = count + 1
for i in range(hmc):
	print(b[i])


input()
a = [*map(len, filter(None, input().split('W')))]
print(len(a))
print(*a)


n = int(input())
a = input().split('W')
for i in range(len(a) - 1, -1, -1):
	if a[i] == '':
		a.pop(i)
print(len(a))
print(' '.join((str(len(j)) for j in a)))


x = int(input())
y = input()
s = []
t = 0
for _ in y.split('W'):
	if len(_) > 0:
		s.append(len(_))
		t += 1
print(t)
print(' '.join((str(_) for _ in s)))


n = int(input())
s = input()
count = 0
x = 0
d = ''
for i in range(len(s)):
	if s[i] == 'B':
		count += 1
		if i == n - 1:
			x = x + 1
			d = d + str(count) + ' '
	elif s[max(i - 1, 0)] == 'B':
		x = x + 1
		d = d + str(count) + ' '
		count = 0
print(x)
if x != 0:
	print(d)


n = int(input())
s = input()
x = s.split('W')
f = [len(i) for i in x if len(i) != 0]
print(len(f))
for i in f:
	print(i, end=' ')


n = int(input())
s = input()
cnt = 0
ls = []
for i in s:
	if i == 'B':
		cnt += 1
	else:
		ls.append(cnt)
		cnt = 0
ls.append(cnt)
new = []
for i in ls:
	if i != 0:
		new.append(i)
print(len(new))
for i in new:
	print(i, end=' ')
if len(new) != 0:
	print()


n = int(input())
a = input()
b = []
i = 0
while i < n:
	if a[i] in 'B':
		j = i
		while i < n and a[i] in 'B':
			i += 1
		b.append(i - j)
	i += 1
print(len(b))
for i in b:
	print(i, end=' ')


def black_white(s):
	if s.count('B') == 0:
		print('0')
		return
	if s.count('W') == 0:
		print(1)
		print(s.count('B'))
		return
	ans = []
	count = 0
	i = 0
	while i < len(s):
		if s[i] == 'B':
			count += 1
		else:
			if count != 0:
				ans.append(str(count))
			count = 0
		i += 1
	if count != 0:
		ans.append(str(count))
	val = ' '.join(ans)
	print(len(ans))
	print(val)
n = int(input())
s = input()
black_white(s)


n = int(input())
s = input()
cnt = 0
ans = []
for i in range(n):
	if s[i] == 'B':
		cnt += 1
	else:
		if cnt:
			ans.append(cnt)
		cnt = 0
if cnt:
	ans.append(cnt)
print(len(ans))
for i in range(len(ans)):
	print(ans[i], end=' ')


n = int(input())
s = input()
i = 0
ans = 0
lst = []
while i < n:
	cnt = 0
	while i < n and s[i] == 'B':
		cnt += 1
		i += 1
	if cnt > 0:
		lst.append(cnt)
		ans += 1
		i -= 1
	i += 1
print(ans)
for num in lst:
	print(num, end=' ')


in1 = int(input())
in2 = input()
k = 0
a = 0
c = 0
ans = []
for i in range(in1):
	if in2[i] == 'B':
		k = k + 1
		a = 1
	if in2[i] == 'W' and a == 1:
		ans.append(k)
		k = 0
		c = c + 1
		a = 0
if in2[in1 - 1] == 'B':
	c = c + 1
	ans.append(k)
print(c)
for i in range(c):
	print(ans[i], end=' ')


input()
ms = input().split('W')
ans = []
for ss in ms:
	if ss != '':
		ans += [str(len(ss))]
print(len(ans))
if len(ans) > 0:
	print(' '.join(ans))


n = int(input())
s = input()
p = -1
k = 1
a = []
a.append(0)
for i in range(n):
	if s[i] == 'B':
		a[k - 1] += 1
		p = 1
	elif p == 1 and s[i] == 'W':
		k += 1
		a.append(0)
		p = 0
if p == 0:
	print(k - 1)
	for i in range(k - 1):
		print(a[i], end=' ')
elif p == 1:
	print(k)
	for i in range(k):
		print(a[i], end=' ')
else:
	print(0)


n = int(input())
inp = input()
res = []
temp = 0
flag = False
for char in inp:
	if char == 'B':
		if flag:
			temp += 1
		else:
			temp = 1
			flag = True
	else:
		if flag:
			res.append(temp)
			temp = 0
		flag = False
if flag:
	res.append(temp)
print(len(res))
print(*res)


blocks = int(input())
dist = str(input())
k = 0
sizes = ''
tempsize = 0
lastisW = True
for i in range(0, blocks):
	if i < blocks - 1:
		if lastisW and dist[i] == 'B':
			k = k + 1
			tempsize = 1
			lastisW = False
		elif lastisW == False and dist[i] == 'B':
			tempsize += 1
			lastisW = False
		elif lastisW == False and dist[i] == 'W':
			sizes = sizes + str(tempsize) + ' '
			tempsize = 0
			lastisW = True
	elif lastisW and dist[i] == 'B':
		k = k + 1
		sizes = sizes + '1'
		lastisW = False
	elif lastisW == False and dist[i] == 'B':
		tempsize += 1
		sizes = sizes + str(tempsize)
		lastisW = False
	elif lastisW == False and dist[i] == 'W':
		sizes = sizes + str(tempsize)
		tempsize = 0
if len(sizes) != 0:
	if sizes[-1] == ' ':
		sizes = sizes[0:len(sizes) - 1]
print(k)
print(sizes)


a = int(input())
l = list(input().split('W'))
l1 = []
for i in range(len(l)):
	if l[i] != '':
		l1.append(l[i])
print(len(l1))
for i in range(len(l1)):
	print(len(l1[i]), end=' ')


def max1(a):
	p = a[0]
	for x in a:
		if x > p:
			p = x
	return p

def preobr(x):
	if x % 2 == 1:
		return x + 1
	else:
		return x - 1

def prlist(a):
	for x in a:
		print(x, end=' ')
n = int(input())
a = input()
k = 0
t = 0
b = []
fl = False
a += 'W'
for i in range(n + 1):
	if a[i] == 'B' and (not fl):
		fl = True
		k += 1
		t += 1
	elif fl and a[i] == 'B':
		t += 1
	elif fl:
		b.append(t)
		t = 0
		fl = False
print(k)
prlist(b)


from math import sqrt

def main():
	n = int(input())
	s = input()
	res = [s[0]]
	s = s[1:]
	while s != '':
		if res[-1][-1] == s[0]:
			res[-1] = res[-1] + s[0]
		else:
			res.append(s[0])
		s = s[1:]
	print(len([str(len(d)) for d in res if d[0] == 'B']))
	print(' '.join([str(len(d)) for d in res if d[0] == 'B']))
main()


input()
a = input().split('W')
b = [len(i) for i in a if len(i) > 0]
print(len(b))
print(*b)


N = input()
s = input()
prev = 'W'
counter = 0
results = []
result = 0
for ch in s:
	if ch == 'W' and prev == 'W':
		continue
	if ch == 'B' and prev == 'W':
		result += 1
		prev = 'B'
		continue
	if ch == 'W' and prev == 'B':
		results.append(result)
		result = 0
		prev = 'W'
		continue
	if ch == 'B' and prev == 'B':
		result += 1
		continue
if prev == 'B':
	results.append(result)
print(len(results))
answer = ''
if len(results) != 0:
	for i in results:
		answer = answer + str(i) + ' '
	print(answer)


i = int(input())
s = input()
count = 0
result = ''
a = 0
for k in range(i):
	if s[0] == 'B':
		count += 1
		s = s[1:]
	elif s[0] == 'W':
		if count != 0:
			result = result + str(count) + ' '
			a += 1
		s = s[1:]
		count = 0
if count != 0:
	print(a + 1)
	print(result + str(count))
else:
	print(a)
	if result != '':
		print(result)


count = input()
string = input()
prev = ''
length = 0
result = []
for x in string + 'W':
	if x == 'B':
		length += 1
	elif length > 0:
		result.append(length)
		length = 0
print(len(result))
print(' '.join(map(str, result)))


n = int(input())
s = input()
w = []
p = 0
k = 0
for i in range(n):
	if s[i] == 'B':
		p += 1
		k = 1
	elif k == 1:
		w.append(p)
		p = 0
		k = 0
if k == 1:
	w.append(p)
print(len(w))
print(*w)


a = input()
b = input().split('W')
c = [_ for _ in b if _ != '']
print(len(c))
d = []
print(' '.join([str(len(i)) for i in c]))


a = int(input())
b = input()

def countGroups(x, y):
	count = 0
	for i in range(0, x - 1):
		if y[i] == 'B' and y[i + 1] == 'W':
			count += 1
	if y[x - 1] == 'B':
		count += 1
	return count

def blocks(x, y):
	count = 0
	for i in range(0, x - 1):
		if y[i] == 'B':
			count += 1
			if y[i + 1] == 'W':
				print(count)
		else:
			count = 0
	if y[x - 1] == 'B':
		print(count + 1)
print(countGroups(a, b))
blocks(a, b)


siz = int(input())
st = input()
lst = list()
lock = 0
cnt = 0
for i in st:
	if i == 'W':
		lock = 0
	else:
		lock = 1
	if lock == 1:
		cnt += 1
	else:
		lst.append(cnt)
		cnt = 0
flag = 0
if cnt > 0:
	lst.append(cnt)
while 0 in lst:
	lst.remove(0)
if len(lst) == 0:
	lst.append(0)
	flag = 1
if flag != 1:
	print(len(lst))
print(*lst)


p = int(input())
n = input()
(k, s, a) = ('', 0, [])
for i in n:
	if i == 'W':
		s = 0
	else:
		s = 1
	if s == 1:
		k = k + i
	if s == 0 and k != '':
		a.append(k)
		k = ''
if k != '':
	a.append(k)
print(len(a))
for i in a:
	print(len(i), end=' ')


n = int(input())
a = list(map(str, input().split('W')))
x = []
for i in range(0, len(a)):
	if len(a[i]) > 0:
		x.append(len(a[i]))
print(len(x))
print(*x)


n = int(input())
s = input().rstrip()
a = []
k = 0
s += 'W'
for i in s:
	if i == 'B':
		k += 1
	else:
		if k > 0:
			a.append(k)
		k = 0
print(len(a))
print(' '.join(map(str, a)))


n = int(input())
s = input()
nd = 0
lst = []
for i in s:
	if i == 'B':
		nd += 1
	else:
		if nd != 0:
			lst.append(nd)
		nd = 0
if nd != 0:
	lst.append(nd)
print(len(lst), sep='')
for i in lst:
	print(i, end=' ')


n = int(input())
a = input()
c = list()
b = int(0)
for i in range(n):
	if a[i] == 'B':
		b += 1
	else:
		c.append(b)
		b = int(0)
c.append(b)
while 0 in c:
	c.remove(0)
print(len(c))
for i in range(len(c)):
	print(c[i], end=' ')


input()
a = [len(i) for i in input().split('W') if i]
print(len(a), *a)


import sys
line = int(sys.stdin.readline().strip())
row = sys.stdin.readline().strip()
res = []
for i in range(line):
	if row[i] == 'B':
		res.append(i)
length = 1
parts = []
for i in range(1, len(res)):
	if res[i] - res[i - 1] == 1:
		length += 1
	else:
		parts.append(length)
		length = 1
if len(res) != 0:
	parts.append(length)
print(len(parts))
print(' '.join(map(str, parts)))


n = int(input())
s = input()
s = s.split('W')
ans = 0
res = []
for c in s:
	if len(c) > 0:
		ans += 1
		res.append(str(len(c)))
print(ans)
print(' '.join(res))


n = input()
s = list(filter(lambda x: len(x) > 0, input().strip().split('W')))
print(len(s))
print(*[len(i) for i in s])


n = int(input().strip())
row = str(input().strip())
count = 0
running = 0
result = []
for i in range(len(row)):
	if row[i] == 'B':
		if running == 0:
			running = 1
			count += 1
		else:
			count += 1
	elif row[i] == 'W':
		if running == 1:
			running = 0
			result.append(str(count))
			count = 0
	if i == len(row) - 1 and running == 1:
		running = 0
		result.append(str(count))
		count = 0
print(len(result))
print(' '.join(result))


n = int(input())
s = input()
t = 0
l = []
st = 0
if 'B' in s:
	st = s.index('B')
	k = s[st]
for i in range(st, n):
	if s[i] == 'B' and s[i] == k:
		t = t + 1
	if s[i] == 'B' and s[i] != k:
		l.append(t)
		t = 1
	k = s[i]
if t != 0:
	l.append(t)
print(len(l))
for i in l:
	print(i, end=' ')


I = input
I()
s = list(map(lambda x: str(len(x)), filter(lambda x: x, I().split('W'))))
print(len(s))
print(' '.join(s))


n = int(input())
num_integers = 0
current_streak = 0
(string, last) = ('', '')
row = input()
for i in row:
	if i == 'B':
		if last == 'B':
			current_streak += 1
		else:
			num_integers += 1
			current_streak = 1
	elif last == 'B':
		string += str(current_streak) + ' '
	last = i
print(num_integers)
if last == 'W':
	if num_integers > 0:
		print(string[:-1])
else:
	print(string + str(current_streak))


n = int(input().strip())
table = input().strip()
groups = 0
group_strength = 0
black_groups = list()
flag = 0
for i in range(n):
	if table[i] == 'B' and flag == 0:
		flag = 1
		group_strength += 1
		if i == n - 1:
			groups += 1
			black_groups.append(str(group_strength))
			group_strength = 0
	elif table[i] == 'B' and flag == 1:
		group_strength += 1
		if i == n - 1:
			groups += 1
			black_groups.append(str(group_strength))
			group_strength = 0
	elif table[i] == 'W' and flag == 1:
		flag = 0
		groups += 1
		black_groups.append(str(group_strength))
		group_strength = 0
print(groups)
if groups != 0:
	print(' '.join(black_groups))


n = int(input())
row = list(filter(None, input().split('W')))
print(len(row))
print(' '.join([str(len(x)) for x in row]))


n = int(input())
arr = list(input())
count = 0
ans = []
for i in arr:
	if i == 'W':
		if count != 0:
			ans.append(count)
		count = 0
	elif i == 'B':
		count += 1
if count != 0:
	ans.append(count)
if len(ans) > 0:
	print(len(ans))
	print(*ans)
else:
	print(0)


n = int(input())
s = input()
sl = s.split('W')
nl = []
for i in sl:
	if len(i) > 0:
		nl += [len(i)]
print(len(nl))
ans = ''
for i in nl:
	ans += str(i) + ' '
if len(nl) != 0:
	print(ans)


n = int(input())
s = input()
final = []
prev = s[0]
count = 0
if n == 1:
	if s[0] == 'B':
		print(1)
		print(1)
	else:
		print(0)
	exit()
if prev == 'B':
	count += 1
for i in range(1, n):
	if s[i] == 'B' and prev == 'B':
		count += 1
	elif s[i] == 'B':
		prev = 'B'
		count = 1
	elif s[i] == 'W' and count != 0:
		final.append(count)
		count = 0
if count != 0:
	final.append(count)
print(len(final))
for nos in final:
	print(nos, end=' ')


n = int(input())
s = input() + 'W'
tmp = []
cnt = 0
anscnt = 0
for i in s:
	if i == 'B':
		cnt += 1
	elif i == 'W' and cnt > 0:
		tmp.append(cnt)
		cnt = 0
		anscnt += 1
print(anscnt)
for i in tmp:
	print(i)


a = int(input())
l = input().split('W')
n = []
m = 0
for i in l:
	if i == '':
		continue
	else:
		m += 1
		n.append(i.count('B'))
print(m)
print(*n)


from collections import defaultdict
import sys, os, math
n = int(input())
s = input()
ans = []
cnt = 0
for i in range(len(s)):
	if s[i] == 'B':
		cnt += 1
		if i == len(s) - 1:
			ans.append(cnt)
	elif cnt > 0:
		ans.append(cnt)
		cnt = 0
print(len(ans))
print(' '.join((str(num) for num in ans)))


n = int(input())
l = [len(i) for i in input().split('W') if i]
print(len(l))
print(*l)


n = int(input())
st = input()
arr = []
if st[0] == 'B':
	arr.append(1)
for i in range(1, n):
	if st[i] == 'B':
		if st[i - 1] == 'B':
			arr[len(arr) - 1] += 1
		else:
			arr.append(1)
print(len(arr))
for i in arr:
	print(i, end=' ')


input()
l1 = []
for x in input().split('W'):
	if 'B' in x:
		l1.append(len(x))
	else:
		pass
print(str(len(l1)) + '\n' + ' '.join(map(str, l1)) if l1 else 0)


n = int(input())
s = input()
(c, count) = (0, 0)
res = ''
for i in range(n):
	if s[i] == 'B':
		c += 1
	elif s[i] == 'W' and c > 0:
		res += str(c) + ' '
		c = 0
		count += 1
if c > 0:
	res += str(c)
	count += 1
if count == 0:
	print(0)
else:
	print(count)
	print(res)


t = int(input())
string = input()
seen = 0
length = 0
con = []
for i in string:
	if i == 'B':
		if seen == 1:
			length = length + 1
		else:
			seen = 1
			length = 1
		t = t - 1
		if t == 0:
			con.append(length)
	elif i == 'W':
		if seen == 0:
			length = 0
		elif seen == 1:
			con.append(length)
			length = 0
			seen = 0
		t = t - 1
print(len(con))
if len(con) != 0:
	for i in con:
		print(i, end=' ')
	print()


input()
s = input().strip('W')
if s:
	while s.find('WW') >= 0:
		s = s.replace('WW', 'W')
	islands = s.split('W')
	print(len(islands))
	for island in islands:
		print(len(island), end=' ')
else:
	print(0)


input()
s = input()
l = []
count = 0
for x in s:
	if x == 'B':
		count += 1
	elif count > 0:
		l.append(count)
		count = 0
if count > 0:
	l.append(count)
print(len(l))
for x in l:
	print(x, end=' ')


n = input()
str = input()
str2 = ''
l1 = []
groups = 0
for i in range(len(str)):
	if str[i] == 'B':
		str2 += 'B'
	elif len(str2) != 0:
		groups += 1
		l1.append(len(str2))
		str2 = ''
if len(str2) != 0:
	groups += 1
	l1.append(len(str2))
	str2 = ''
print(groups)
for i in l1:
	print(i, end=' ')


n = int(input())
s = str(input())
r = list(s)
l = []
h = 0
for i in range(n):
	if r[i] == 'B':
		h += 1
	elif r[i] != 'B' and h != 0:
		l.append(h)
		h = 0
if h != 0:
	l.append(h)
	h = 0
print(len(l))
print(' '.join([str(i) for i in l]))


n = int(input())
s = input()
l = s.split('W')
c = 0
for i in l:
	if i != '':
		c += 1
print(c)
for i in l:
	if i != '':
		print(len(i), end=' ')


n = int(input())
s = input() + 'W'
last = 'W'
group = 0
counter = 0
a = []
for i in range(len(s)):
	if s[i] == 'W' and group != 0 and (last != 'W'):
		a.append(counter)
		counter = 0
		last = 'W'
	elif s[i] != 'W' and last == 'W':
		group += 1
		counter += 1
		last = 'B'
	elif s[i] != 'W':
		counter += 1
		last = 'B'
print(group)
print(*a)


n = int(input())
p = input()
if 'B' not in p:
	print(0)
	quit()
else:
	s = list(p.split('W'))
	while '' in s:
		s.remove('')
	print(len(s))
	if len(s) > 0:
		for i in s:
			print(len(i), end=' ')


input()
x = input()
n = (x[0] == 'B') + x.count('WB')
print(n)
if n:
	print(' '.join([str(len(i)) for i in x.split('W') if i]))


input()
groups = [len(c) for c in input().split('W') if len(c) > 0]
print(len(groups))
if groups:
	print(' '.join([str(i) for i in groups]))


input()
z = input()
z = z.split('W')
for i in range(z.count('')):
	z.remove('')
if len(z) > 0:
	print(len(z))
	for i in z:
		print(len(i), end=' ')
else:
	print(0)


q = int(input())
w = input()
ans = [len(i) for i in w.split('W') if i != '']
l = len(ans)
v = ' '.join((str(i) for i in ans))
print(l)
print(v)


n = int(input())
s = input()

def solve1(n, s):
	res = []
	count = 0
	for c in s:
		if c == 'B':
			count += 1
		if c == 'W':
			if count > 0:
				res.append(count)
			count = 0
	if count >= 1:
		res.append(count)
	print(len(res))
	if len(res) >= 1:
		for c in range(len(res) - 1):
			print(res[c], end=' ')
		print(res[len(res) - 1], end='')
solve1(n, s)


n = int(input())
s = input()
if 'B' not in s:
	print('0')
elif 'W' not in s:
	print('1')
	print(len(s))
else:
	l = []
	while s != '':
		if s[0] == 'W':
			if 'B' not in s:
				break
			x = s.index('B')
			s = s[x:]
		else:
			if 'W' not in s:
				l.append(str(len(s)))
				break
			x = s.index('W')
			l.append(str(x))
			s = s[x:]
	print(len(l))
	s = ' '.join(l)
	print(s)


n = int(input())
stri = input().split('W')
count = 0
listy = []
for i in stri:
	if 'B' in i:
		count += 1
		j = len(i)
		listy.append(j)
print(count)
for i in listy:
	print(i, end=' ')


n = int(input())
s = input().split('W')
a = []
for i in s:
	if len(i) >= 1:
		a.append(len(i))
print(len(a))
for i in a:
	print(i, end=' ')


n = int(input())
s = list(input())
c = 0
b = 0
shifr = []
for i in range(1, n):
	if s[i - 1] == 'B':
		b += 1
	if s[i] != s[i - 1] and s[i - 1] == 'B':
		c += 1
		shifr.append(b)
		b = 0
if s[-1] == 'B':
	c += 1
	b += 1
	shifr.append(b)
print(c)
print(' '.join(map(str, shifr)))


no = int(input())
sti = input().split('W')
res = []
count = 0
for i in sti:
	if i == '':
		continue
	count += 1
	res.append(len(i))
print(count)
for i in res:
	print(i, end=' ')


n = int(input())
val = input()
antidote = []
c = 0
consec = 0
for i in range(n):
	if val[i] == 'B':
		consec += 1
	elif val[i] == 'W':
		if consec >= 1:
			antidote.append(str(consec))
			consec = 0
if consec > 0:
	antidote.append(str(consec))
c = len(antidote)
if len(antidote) != 0:
	print(c)
	for i in range(len(antidote)):
		print(antidote[i], end=' ')
else:
	print(c)


n = int(input())
s = input()
i = 0
c = 0
c1 = []
while i < n:
	if s[i] == 'B':
		c += 1
	else:
		if c != 0:
			c1.append(c)
		c = 0
	i += 1
if c != 0:
	c1.append(c)
if len(c1) == 0:
	print(0)
else:
	print(len(c1))
	for j in c1:
		print(j, end=' ')


n = int(input())
alpha = input()
k = alpha.split('W')
res = []
count = 0
for i in k:
	if len(i) > 0:
		count += 1
		res.append(str(len(i)))
print(count)
print(' '.join(res))


n = int(input())
s = input()
a = []
l = 0
i = 0
while i < n:
	if s[i] == 'B':
		l += 1
		a.append(0)
		while i != n and s[i] == 'B':
			i += 1
			a[-1] += 1
	i += 1
print(l)
print(*a)


n = int(input())
r1 = list()
r2 = list()
l = input().split('W')
for i in l:
	if i != '':
		r1.append(i)
		r2.append(len(i))
print(len(r1))
print(*r2)


n = int(input())
s = input()
result = []
numB = 0
numChange = 0
for i in range(len(s)):
	if s[i] == 'B':
		break
s = s[i:]
for i in range(len(s)):
	if s[i] == 'B':
		numB += 1
	else:
		if numB != 0:
			result.append(str(numB))
		numB = 0
		if i != len(s) - 1 and s[i] != s[i + 1]:
			numChange += 1
	if i == len(s) - 1:
		if s[i] == 'B':
			result.append(str(numB))
flag = 0
for i in s:
	if i == 'B':
		flag = 1
if flag == 0:
	print('0')
else:
	print(numChange + 1)
	for i in range(len(result) - 1):
		print(result[i], end=' ')
	print(result[-1])


n = int(input())
st = input()
data = []
flg = True
k = 0
for x in st:
	if x == 'B':
		k += 1
		flg = True
	elif flg:
		flg = False
		if k != 0:
			data.append(k)
		k = 0
if flg:
	data.append(k)
print(len(data))
print(*data)


n = int(input())
CR = input()
cur = 0
cr = []
for ch in CR:
	if ch == 'W':
		if cur:
			cr.append(cur)
		cur = 0
	else:
		cur += 1
if cur:
	cr.append(cur)
print(len(cr))
print(*cr)


I = lambda : map(int, input().split())
n = I()
s = input()
n = []
i = 0
temp = int(s[0] == 'B')
for i in range(1, len(s)):
	if s[i] == 'W' and s[i - 1] == 'B':
		n.append(temp)
		temp = 0
	elif s[i] == 'B':
		temp += 1
if s[len(s) - 1] == 'B':
	n.append(temp)
print(len(n))
if len(n) != 0:
	for x in n:
		print(x, end=' ')


n = int(input())
x = input()
tot = 0
sol = []
for i in range(0, n):
	if x[i] == 'B':
		tot += 1
	else:
		if tot > 0:
			sol.append(tot)
		tot = 0
if tot > 0:
	sol.append(tot)
print(len(sol))
for i in sol:
	print(i, '', end='')


n = int(input())
s = [i for i in input().strip('W').split('W') if i]
res = [len(i) for i in s]
print(len(res))
if len(res) > 0:
	print(*res)


N = int(input())
array = list(input()) + ['W']
something = []
counter = 0
for i in range(N + 1):
	if array[i] == 'B':
		counter += 1
	if array[i] == 'W':
		if counter != 0:
			something.append(counter)
		counter = 0
print(len(something))
print(*something, sep=' ')


n = int(input())
s = input()
bc = 0
bs = []
for i in range(n):
	if s[i] == 'B':
		bc += 1
		if i == n - 1:
			bs.append(bc)
	elif bc > 0:
		bs.append(bc)
		bc = 0
print(len(bs))
for g in bs:
	print(g, end=' ')
print()


n = int(input())
s = input()
tmp = 0
D = []
for i in s:
	if i == 'B':
		tmp += 1
	elif tmp > 0:
		D.append(tmp)
		tmp = 0
if tmp > 0:
	D.append(tmp)
print(len(D))
print(*D)


t = int(input())
s = input().replace('W', ' ').split()
print(len(s))
for i in s:
	print(len(i), end=' ')


def printStrings(strings):
	for element in strings:
		print(element)
k = input()
n = input()
bcount = 0
wcount = 0
list = []
for i in n:
	if i == 'B':
		bcount = bcount + 1
	elif i == 'W':
		if bcount >= 1:
			wcount = wcount + 1
			list.append(bcount)
		bcount = 0
if bcount >= 1:
	list.append(bcount)
	wcount = wcount + 1
print(wcount)
printStrings(list)


lol = input()
encr = input()
black = [i for i in range(len(encr)) if encr[i] == 'B']
black.append(1000000000)
if len(black) == 0:
	print(0)
else:
	no = 0
	block = []
	long = 1
	for i in range(1, len(black)):
		if black[i] == black[i - 1] + 1:
			long += 1
			continue
		else:
			no += 1
			block.append(long)
			long = 1
	print(no)
	print(*block)


n = int(input())
s = input()
ans = []
for b in s.split('W'):
	ans.append(len(b))
ans = [x for x in ans if x != 0]
print(len(ans))
if len(ans) > 0:
	for x in ans:
		print(x, end=' ')


input()
c = input()
out = [str(len(x)) for x in c.split('W') if x]
print(len(out))
print(' '.join(out))


import time

def identifyBlackGroups(rowLen, bwRow):
	bList = []
	indCount = 0
	blackFound = False
	for x in range(rowLen):
		if bwRow[x] == 'W':
			if blackFound == True:
				bList.append(indCount)
				indCount = 0
				blackFound = False
		elif bwRow[x] == 'B':
			blackFound = True
			indCount += 1
	if blackFound == True:
		bList.append(indCount)
		indCount = 0
		blackFound = False
	return bList

def printResults(listA):
	print(len(listA))
	print(' '.join((str(blacks) for blacks in listA)))

def solve():
	rowLen = int(input())
	bwRow = input()
	printResults(identifyBlackGroups(rowLen, bwRow))
solve()


n = int(input())
s = input()
k = s.split('W')
c = 0
res = []
for x in k:
	if x == '':
		continue
	c += 1
	res.append(str(len(x)))
print(c)
print(' '.join(res))


n = int(input())
s = input()
b_c = 0
last = ''
a = []
for i in range(n):
	if s[i] == 'B':
		if s[i] == last:
			b_c += 1
		else:
			b_c = 1
	else:
		if b_c:
			a.append(b_c)
		b_c = 0
	last = s[i]
if last == 'B':
	a.append(b_c)
print(len(a))
if len(a):
	print(*a)


n = input()
n = int(n)
str = input()
str = str + 'D'
LIST = list()
c = 0
for i in str:
	if i == 'B':
		c += 1
	else:
		if c > 0:
			LIST.append(c)
		c = 0
print(len(LIST))
print(*LIST)


input()
inp = list(input())
num = int()
matrix = []
if inp[-1] == 'B':
	inp.append('W')
for x in range(len(inp)):
	if inp[x] == 'B':
		num = num + 1
	elif inp[x] == 'W':
		matrix.append(str(num))
		num = int()
		if matrix[-1] == '0':
			matrix.pop(-1)
print(len(matrix))
print(' '.join(matrix))


n = int(input())
s = input()
c = []
a = 0
i = 0
while i < n:
	if s[i] == 'B':
		a += 1
		q = 0
		while i < n and s[i] == 'B':
			q += 1
			i += 1
		c.append(q)
	i += 1
print(a)
for i in range(len(c)):
	print(c[i], end=' ')


n = int(input())
values = input()
print(len(list(filter(None, values.split('W')))))
for value in list(filter(None, values.split('W'))):
	print(len(value), end=' ')


num = int(input())
row = [str(in_str) for in_str in input()]
count = 0
length_B = None
len_array = []
prev = 'W'
for i in range(len(row)):
	current = row[i]
	if prev == 'W' and current == 'B':
		count += 1
		length_B = 1
	elif prev == 'B' and current == 'B':
		length_B += 1
	elif prev == 'B' and current == 'W':
		len_array.append(length_B)
	prev = current
current = 'W'
if prev == 'B' and current == 'W':
	len_array.append(length_B)
print(count)
string = ''
for i in range(len(len_array)):
	string += str(len_array[i])
	if i < len(len_array) - 1:
		string += ' '
print(string)


import re
input()
s = input()
ans = list(map(len, re.findall('B+', s)))
print(len(ans))
if len(ans) > 0:
	print(*ans)


n = int(input())
s = input().strip('W').split('W')
n = 0
lens = len(s)
for i in range(lens):
	if s[i] != '':
		n += 1
print(n)
for i in range(lens):
	if s[i] != '':
		print(len(s[i]), end=' ')


n = int(input())
p = input()
p = p + 'W'
q = 0
t = []
for i in range(n + 1):
	if p[i] == 'B':
		q += 1
	elif q != 0:
		t.append(q)
		q = 0
print(len(t))
for i in t:
	print(i, end=' ')


n = int(input())
code = input().strip('W').split('W')
result = [len(c) for c in code if c != '']
print(len(result))
print(*result)


n = int(input())
a = list((len(ch) for ch in input().split('W')))
while 0 in a:
	a.remove(0)
print(len(a))
print(*a)


n = int(input())
a = input()
w = []
p = []
for i in range(n):
	if a[i] == 'W':
		w.append(i)
if len(w) == 0:
	print(1)
	print(n)
elif len(w) == n:
	print(0)
else:
	if w[0] != 0:
		p.append(w[0])
	for i in range(1, len(w)):
		if abs(w[i - 1] - w[i]) > 1:
			p.append(w[i] - 1 - w[i - 1])
	if w[-1] != n - 1:
		p.append(n - 1 - w[-1])
	print(len(p))
	for i in range(len(p)):
		print(p[i], end=' ')


n = int(input())
s = input()
bl_list = []
bl = 0
for x in list(s):
	if x == 'B':
		bl += 1
	else:
		bl_list.append(bl)
		bl = 0
bl_list.append(bl)
bl_list = [str(x) for x in bl_list if x != 0]
print(len(bl_list))
print(' '.join(bl_list))


n = int(input())
z = input()
arr = []
count = 0
for i in range(n):
	if z[i] == 'B':
		count += 1
	elif count > 0:
		arr.append(count)
		count = 0
if count > 0:
	arr.append(count)
print(len(arr))
for i in range(len(arr)):
	if i == len(arr) - 1:
		print(arr[i])
	else:
		print(arr[i], end=' ')


n = int(input())
string = input()
if string.count('B'):
	count = 1
else:
	print('0')
	count = 0
res = []
countb = 0
if count:
	total = 0
	for i in range(n):
		if string[i] == 'B' and i == n - 1:
			countb += 1
			res.append(countb)
			total += 1
		elif string[i] == 'B':
			countb += 1
		elif countb:
			total += 1
			res.append(countb)
			countb = 0
	if total == 0:
		print(count)
		print(countb)
	else:
		print(total)
		print(*res, end=' ')


input()
s = input().replace('W', ' ').split()
print(len(s))
for i in s:
	print(len(i), end=' ')


n = int(input())
s = input().strip('W').split('W')
t = []
for subs in s:
	if subs != '':
		t.append(subs)
print(len(t))
for subt in t:
	print(len(subt), end=' ')


trash = input()
board = str(input())
i = 0
sequences = []
running = 0
for i in range(0, len(board)):
	if board[i] == 'W':
		if running > 0:
			sequences.append(running)
		running = 0
	else:
		running += 1
if running > 0:
	sequences.append(running)
print(len(sequences))
out = ''
if len(sequences) > 0:
	for i in range(len(sequences)):
		out = out + str(sequences[i])
		if i < len(sequences) - 1:
			out = out + ' '
	print(out)


a = int(input())
s = input()
cnt = 0
fcnt = 0
ans = []
for i in s:
	if i is 'B':
		cnt += 1
	if i is 'W':
		if cnt != 0:
			ans.append(cnt)
			fcnt += 1
		cnt = 0
if cnt != 0:
	ans.append(cnt)
	fcnt += 1
print(fcnt)
for i in ans:
	print(i, end=' ')


n = int(input())
s = str(input())
op = []
i = 0
k = 0
count = 0
if 'B' not in s:
	print(0)
else:
	while i < n:
		if s[i] == 'B':
			try:
				while s[i + k] == 'B':
					k += 1
					count += 1
				op.append(count)
				i = i + k
				k = 0
				count = 0
			except:
				op.append(count)
				i = n
		else:
			i += 1
	print(len(op))
	for i in op:
		print(i, end=' ')


n = int(input())
line = input().strip('W').split('W')
block = 0
newLine = []
for elem in line:
	if elem != '':
		block += 1
		newLine.append(len(elem))
print(block)
print(' '.join((str(x) for x in newLine)))


n = int(input())
s = input() + 'W'
path = []
now = 0
for i in range(n + 1):
	if s[i] == 'W' and now > 0:
		path.append(now)
		now = 0
	elif s[i] == 'B':
		now += 1
print(len(path))
print(*path)


n = int(input())
s = list(input())
A = []
i = 0
while i < n:
	if s[i] != 'B':
		i += 1
		continue
	j = i + 1
	while j < n and s[j] == 'B':
		j += 1
	A.append(j - i)
	i = j
print(len(A))
print(*A)


n = input()
adjust = input()
k = 0
cout = 0
a = []
b = ' '
for i in adjust:
	if k != 0 and i == 'B':
		k += 1
	elif i == 'B':
		k += 1
	elif i != 'B' and k != 0:
		a.append(k)
		k = 0
		cout += 1
if k != 0:
	a.append(k)
	cout += 1
print(cout)
print(' '.join((str(i) for i in a)))


n = int(input().strip())
s = input().strip()
l = []
i = 0
while i < len(s):
	while i < len(s) and s[i] == 'W':
		i += 1
	t = 0
	while i < len(s) and s[i] == 'B':
		t += 1
		i += 1
	l.append(t)
if l[-1] == 0:
	del l[-1]
print(len(l))
for i in l:
	print(i, end=' ')


n = int(input())
line = str(input())
line = list(map(str, filter(lambda x: x > 0, map(len, line.split('W')))))
print(len(line))
print(' '.join(line))


n = int(input())
s = input()
ar = []
su = 0
for i in s:
	if i == 'B':
		su += 1
	elif su:
		ar.append(su)
		su = 0
if su:
	ar.append(su)
print(len(ar))
for j in ar:
	print(j, end=' ')


lst = []
f = 0
c = 0
z = int(input())
x = list(map(str, input()))
for i in range(z):
	if x[i] == 'B':
		c += 1
		if f == z - 1:
			lst.append(c)
	elif c > 0:
		lst.append(c)
		c = 0
	f += 1
print(len(lst))
print(*lst)


n = int(input())
s = input()
cur = 0
arr = []
for i in range(n):
	if s[i] == 'B':
		cur += 1
	else:
		if cur != 0:
			arr.append(cur)
		cur = 0
if cur != 0:
	arr.append(cur)
n = len(arr)
print(n)
if n != 0:
	print(*arr)


n = int(input())
s = input()
if 'B' not in s:
	print(0)
else:
	print(len([str(len(x)) for x in s.split('W') if x]))
	print(' '.join([str(len(x)) for x in s.split('W') if x]))


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
lens = int(input())
cw = read_str().split('W')
ans = []
for i in cw:
	if len(i) >= 1:
		ans.append(len(i))
if len(ans) > 0:
	print(len(ans))
	print(*ans)
else:
	print(0)


n = int(input())
line = list((len(x) for x in input().split('W') if x))
print(len(line))
if len(line) > 0:
	print(*line, sep=' ')


n = int(input())
s = input()
count = 0
l = []
for i in range(n):
	if s[i] == 'W':
		if count > 0:
			l.append(count)
		count = 0
	else:
		count += 1
if count > 0:
	l.append(count)
print(len(l))
print(' '.join([str(i) for i in l]))


a = int(input())
b = input()
g = 0
s = []
for cube in b:
	if cube == 'B':
		g += 1
	elif g > 0:
		s.append(str(g))
		g = 0
if g > 0:
	s.append(str(g))
print(len(s))
print(' '.join(s))


n = int(input())
s = input()
a = []
i = 0
b = 0
while i < n:
	if s[i] == 'B':
		b += 1
	elif b:
		a.append(b)
		b = 0
	i += 1
if b:
	a.append(b)
print(len(a))
for i in a:
	print(i)


a = input()
b = input()
b = b.split('W')
c = []
for i in b:
	if i != '':
		c.append(i)
out1 = len(c)
out2 = ''
for j in c:
	out2 += str(len(j)) + ' '
print(out1)
print(out2[:-1])


n = int(input())
vec = input()
nv = 0
la = 0
res = ''
espacio = ''
for i in range(len(vec)):
	if vec[i] == 'B':
		la += 1
	elif la > 0:
		nv += 1
		res += espacio + str(la)
		la = 0
		espacio = ' '
if la > 0:
	nv += 1
	res += espacio + str(la)
	la = 0
	espacio = ' '
print(nv)
if nv > 0:
	print(res)


n = int(input())
s = input()
(k, c) = ([], 0)
for x in range(n - 1):
	if s[x] == 'B' and s[x + 1] == 'B':
		c += 1
	elif s[x] == 'B' and s[x + 1] == 'W':
		k.append(c + 1)
		c = 0
if s[-1] == 'B':
	k.append(c + 1)
print(len(k))
print(*k)


n = int(input())
word = input()
counter = 0
List = []
for i in word:
	if i == 'B':
		counter += 1
	elif not counter == 0:
		List.append(counter)
		counter = 0
if not counter == 0:
	List.append(counter)
print(len(List))
for i in List:
	print(i, end=' ')


n = int(input())
m = list(input().split('W'))
while '' in m:
	m.remove('')
p = []
for i in m:
	p.append(len(i))
print(len(m))
print(*p)


n = int(input())
a = input()
m = []
c = 0
for i in range(len(a)):
	if a[i] == 'B':
		c = c + 1
	else:
		if c != 0:
			m.append(c)
		c = 0
if c != 0:
	m.append(c)
print(len(m))
for i in m:
	print(i, end=' ')


n = int(input())
x = input()
s = 0
k = 0
l = []
for i in x:
	if i == 'B':
		s += 1
	elif s != 0:
		k += 1
		l.append(s)
		s = 0
if s != 0:
	k += 1
	l.append(s)
print(k)
for i in l:
	print(i, end=' ')


n = int(input())
s = input()
l = list(s.split('W'))
count = 0
size = []
for i in range(len(l)):
	if len(l[i]) != 0:
		count += 1
		size.append(len(l[i]))
print(count)
for i in size:
	print(i, end=' ')


n = int(input())
a = input().replace('W', ' ').split()
print(len(a))
if len(a):
	for i in a:
		print(len(i), end=' ')


input()
sek = input().split('W')
s = []
for i in sek:
	if i != '':
		s.append(i)
print(len(s))
for i in s:
	if i != '':
		print(len(i), end=' ')


input()
str = input()
ls = []
cnt = 0
for s in str:
	if s == 'B':
		cnt += 1
	else:
		if cnt != 0:
			ls.append(cnt)
		cnt = 0
if cnt > 0:
	ls.append(cnt)
print(len(ls))
for l in ls:
	print(l, end=' ')


n = int(input())
row = input()
groups = []
prev = 'W'
acum = 0
for curr in row + 'W':
	if prev == 'B':
		if curr == 'B':
			acum += 1
		else:
			groups.append(acum)
			acum = 0
	elif curr == 'B':
		acum = 1
	prev = curr
print(len(groups))
print(*groups)


n = int(input())
s = str(input())
R = []
b = 0
for i in range(n):
	if s[i] == 'B':
		b += 1
	elif b > 0:
		R += [b]
		b = 0
if b > 0:
	R += [b]
print(len(R))
for i in range(len(R)):
	print(R[i], end=' ')


n = int(input())
s = input()
s += 'W'
a = []
k = 0
for i in range(n + 1):
	if s[i] == 'B':
		k += 1
	elif i and s[i - 1] == 'B':
		a.append(k)
		k = 0
print(len(a))
if len(a) > 0:
	print(' '.join(map(str, a)))


n = int(input())
lst = input().split('W')
m = 0
for element in lst:
	if len(element) > 0:
		m += 1
print(m)
for element in lst:
	if len(element) > 0:
		print(len(element), end=' ')


_ = input()
s = input()
a = [i for i in s.split('W') if i != '']
b = []
for i in a:
	b.append(str(len(i)))
print(len(b))
print(' '.join(b))


from itertools import groupby
ch_cnt = int(input())
string = input()
tmp = [str(len(tuple(g))) for (k, g) in groupby(string) if k == 'B']
print(len(tmp))
print(' '.join(tmp))


(a, d) = (input(), [str(len(i)) for i in input().split('W') if len(i)])
print(len(d))
if len(d):
	print(' '.join(d))


p = input()
s = input()
c = 0
r = []
for i in s:
	if i == 'B':
		if c == 0:
			c = 1
			r.append(1)
		else:
			r[-1] += 1
	else:
		c = 0
print(len(r))
print(' '.join((str(i) for i in r)))


n = int(input().strip())
s = input().strip()
s = s.split('W')

def fil(lis):
	for i in lis:
		if i != '':
			return True
		else:
			return False
s = list(filter(fil, s))
print(len(s))
for i in s:
	print(len(i), end=' ')


n = int(input())
st = list(input())
l = []
i = 0
while i < n:
	x = st[i]
	if x == 'B':
		c = 0
		for j in range(i, n):
			if x == st[j]:
				c += 1
				i += 1
			else:
				break
		l.append(c)
	i += 1
print(len(l))
for i in l:
	print(i, end=' ')


t = int(input())
n = input()
m = n.split('W')
count = 0
count1 = 0
ar = []
for i in m:
	if i != '':
		count += 1
print(count)
for i in range(t):
	if n[i] == 'B':
		count1 += 1
	else:
		ar.append(count1)
		count1 = 0
if count1 != 0:
	ar.append(count1)
for i in ar:
	if i == 0:
		pass
	else:
		print(i, end=' ')


n = int(input())
s = input()
count = 0
i = 0
enc = []
while i < n:
	temp = 0
	if s[i] == 'B':
		count += 1
		while i < n and s[i] == 'B':
			i += 1
			temp += 1
	if temp > 0:
		enc.append(temp)
		i -= 1
	i += 1
print(count)
for i in enc:
	print(i, end=' ')


n = int(input())
s = input()
list = s.split('W')
v = 0
for i in list:
	if i != '':
		v += 1
print(v)
s = ''
if v != 0:
	for i in list:
		if len(i) != 0:
			s += str(len(i))
			s += ' '
print(s)


n = int(input())
s = input()
i = 0
list1 = []
while i <= len(s) - 1:
	p = 0
	if s[i] == 'B':
		while i < len(s) and s[i] == 'B':
			p = p + 1
			i += 1
		list1.append(p)
	i += 1
print(len(list1))
for i in list1:
	print(i, end=' ')


a = int(input())
k = list(input())
ans = []
flag = 0
for i in range(a):
	if k[i] == 'B' and flag == 0:
		(flag, num) = (1, 1)
	elif k[i] == 'B' and flag == 1:
		num += 1
	elif flag == 1:
		ans.append(num)
		(num, flag) = (0, 0)
if flag == 1:
	ans.append(num)
print(len(ans))
print(' '.join([str(i) for i in ans]))


n = int(input())
string = input()
i = 0
groups = 0
groupList = []
while i < n:
	if string[i] == 'B':
		j = i + 1
		groups += 1
		count = 1
		while j < n:
			if string[j] == 'B':
				count += 1
			else:
				break
			j += 1
		i = j - 1
		groupList.append(count)
	i += 1
print(groups)
print(' '.join((str(x) for x in groupList)))


n = int(input())
s = input()
b = 0
s += '.'
hasil = []
for i in range(len(s)):
	if s[i] == 'B':
		b += 1
	else:
		if b != 0:
			hasil += [b]
		b = 0
print(len(hasil))
for i in hasil:
	print(i, end=' ')


input()
s = [str(len(x)) for x in input().split('W') if x]
print(len(s), '\n', ' '.join(s))


n = int(input())
s = input()
c = 0
cur = 0
l = []
for i in range(n):
	if s[i] == 'B':
		cur += 1
	elif cur != 0:
		l.append(cur)
		cur = 0
if cur != 0:
	l.append(cur)
if len(l) != 0:
	print(len(l))
	print(*l)
else:
	print(len(l))


input()
L = [len(z) for z in input().split('W') if '' != z]
print(len(L))
print(*L)


n = int(input())
s = list(input())
x = 0
k = ''
m = 0
for i in s:
	if i == 'B':
		x += 1
	elif x != 0:
		k += str(x)
		k += ' '
		x = 0
		m += 1
if s[n - 1] == 'B':
	m += 1
	k += str(x)
	k += ' '
print(m)
print(k)


n = int(input())
str = input()
li = []
cnt = 0
for i in range(0, len(str)):
	if str[i] == 'B':
		cnt += 1
	elif cnt > 0:
		li.append(cnt)
		cnt = 0
if cnt > 0:
	li.append(cnt)
print(len(li))
for i in range(0, len(li)):
	print(li[i], end=' ')


n = int(input())
s = input()
cnt = 0
l = []
for i in range(len(s)):
	if s[i] == 'B':
		cnt += 1
	elif s[i] == 'W' and cnt > 0:
		l.append(cnt)
		cnt = 0
	if i == len(s) - 1 and s[i] == 'B':
		l.append(cnt)
if len(l) == '0':
	print('0')
else:
	print(len(l))
	print(*l)


a = int(input())
b = input().split('W')
for i in range(b.count('')):
	b.remove('')
print(len(b))
for i in b:
	print(len(i), end=' ')


n = int(input())
s = input().split('W')
ans = [len(i) for i in s if len(i) > 0]
print(len(ans))
print(*ans)


n = int(input())
s = input()
a = []
now = 0
for ch in s:
	if ch == 'B':
		now += 1
	else:
		if now > 0:
			a.append(now)
		now = 0
if now > 0:
	a.append(now)
print(len(a))
for i in a:
	print(i, end=' ')


n = int(input())
s = list(filter(lambda x: x != '', input().split('W')))
print(len(s))
for e in s:
	print(len(e), end=' ')


n = int(input())
l = input()
c = 0
b = 1
li = []
l = l.split('W')
while '' in l:
	l.remove('')
ans = []
for i in l:
	ans.append(len(i))
print(len(ans))
print(*ans)


n = int(input())
string = input()
result = str()
counter = int()
for i in string:
	if i == 'B':
		counter += 1
	elif i == 'W' and counter:
		result += f' {counter}'
		counter = 0
else:
	if counter:
		result += f' {counter}'
result = result.strip()
print(len(result.split()))
if result:
	print(result)


n = int(input())
s = input().split('W')
count = 0
my_list = []
for i in s:
	if 'B' in i:
		count += 1
		my_list.append(str(len(i)))
str1 = ' '.join(my_list)
print(count)
print(str1)


n = int(input())
c = input() + 'W'
a = 0
b = []
for i in range(n + 1):
	if c[i] == 'B':
		a += 1
		continue
	if a > 0:
		b.append(a)
		a = 0
print(len(b))
for i in b:
	print(i, end=' ')


import math
l = []
l1 = []
t = int(input())
s = str(input())
f = s
k = len(s)
s1 = s[k - 1]
if s1 == 'B':
	f += 'W'
else:
	f = s
g = s.count('B')
sum = 0
if g > 0:
	for i in range(0, len(f), 1):
		if f[i] == 'B':
			sum += 1
		else:
			d = sum
			l.append(d)
			sum = 0
	for i in l:
		if i != 0:
			l1.append(i)
	print(len(l1))
	for i in l1:
		print(i, end=' ')
	print()
else:
	print(0)


n = int(input())
s = input()
count = 0
a = []
for i in range(n):
	if i == n - 1:
		if s[i] == 'B':
			count += 1
			a.append(str(count))
	elif s[i] == 'B':
		count += 1
		if s[i + 1] == 'W':
			a.append(str(count))
			count = 0
print(len(a))
if a:
	print(' '.join(a))


x = int(input())
y = input()
z = 0
l = []
h = 0
while z < x:
	h = 0
	while z < x and y[z] == 'B':
		h += 1
		z += 1
	if h != 0:
		l.append(h)
	z += 1
print(len(l))
z = 0
while z < len(l):
	print(l[z], end=' ')
	z += 1


n = int(input())
s = input()
cnt = 0
cnts = []
k = 0
for i in range(n + 1):
	if i != n and s[i] == 'B':
		cnt += 1
	else:
		if cnt > 0:
			k += 1
			cnts.append(cnt)
		cnt = 0
print(k)
for cnt in cnts:
	print(cnt, end=' ')


a = int(input())
s = input() + 'W'
mat = []
cantin = False
step = 0
for i in s:
	if i == 'W':
		if cantin:
			cantin = False
			mat.append(step)
	elif cantin:
		step += 1
	else:
		cantin = True
		step = 1
print(len(mat))
for i in mat:
	print(i, end=' ')


import math
from fractions import Fraction as frac
MOD = 1000000000.0 + 7

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def solve(case_no):
	n = int(input())
	s = str(input())
	ans = []
	cnt = 0
	for i in range(n):
		if s[i] == 'B':
			cnt += 1
		else:
			if cnt > 0:
				ans.append(cnt)
			cnt = 0
	if cnt > 0:
		ans.append(cnt)
	print(len(ans))
	for i in range(len(ans)):
		print(ans[i], end=' ')
	print()
t = 1
for i in range(1, t + 1):
	solve(i)


i = int(input())
w = input()
a = [len(x) for x in w.split('W')]
a = [x for x in a if x is not 0]
print(len(a))
for i in a:
	print(i, end=' ')


n = int(input())
s = input()
flag = 0
sum = 0
l = []
t = 0
for i in range(0, n):
	if flag == 0:
		tmp = s[i]
		if s[i] == 'B':
			t += 1
			sum += 1
		flag = 1
	elif s[i] == 'B':
		if tmp == 'W':
			t += 1
		sum += 1
	elif tmp == 'B':
		l.append(sum)
		sum = 0
	tmp = s[i]
if not sum == 0:
	l.append(sum)
if t == 0:
	print(0)
else:
	str1 = ''
	for i in range(0, len(l) - 1):
		str1 = str1 + str(l[i]) + ' '
	str1 = str1 + str(l[len(l) - 1])
	print(t)
	print(str1)


n = int(input())
s = input()
(cnt, l) = (0, 0)
isBlack = False
h = []
for i in range(len(s)):
	if s[i] == 'B':
		if not isBlack:
			cnt += 1
			isBlack = True
		l += 1
	if s[i] == 'W' and isBlack or i == len(s) - 1:
		isBlack = False
		if l != 0:
			h.append(l)
		l = 0
print(cnt)
for x in h:
	print(x, end=' ')


n = int(input().strip())
kras = input().strip() + 'W'
k = []
l = 0
for i in range(n + 1):
	if kras[i] == 'B':
		l += 1
	elif l != 0:
		k.append(str(l))
		l = 0
print(len(k))
print(' '.join(k))


n = int(input())
s = str(input())
counter = 0
was_black = 0
blocks = []
for x in s + 'W':
	if x == 'B':
		counter += 1
		was_black = True
	if x == 'W' and was_black:
		blocks.append(counter)
		counter = 0
	if x == 'W':
		was_black = 0
k = len(blocks)
print(k)
if k != 0:
	print(' '.join([str(x) for x in blocks]))


n = int(input())
a = input().split('W')
v = [len(x) for x in a if len(x) > 0]
print(len(v))
print(*v)


size = input()
letras = input()
arraycontador = []
arraycontador.append(0)
indicei = 0
for l in letras:
	if l == 'W':
		if arraycontador[indicei] > 0:
			indicei += 1
			arraycontador.append(0)
	else:
		arraycontador[indicei] += 1
if arraycontador[indicei] == 0:
	del arraycontador[indicei]
print(len(arraycontador))
print(''.join((str(e) + ' ' for e in arraycontador)))


n = int(input())
str = input()
c = 0
lst = []
for i in range(n):
	if str[i] == 'B':
		c += 1
	if str[i] == 'W' and c != 0:
		lst.append(c)
		c = 0
if c != 0:
	lst.append(c)
print(len(lst))
for i in lst:
	print(i, end=' ')


n = int(input())
l = list(input().split('W'))
l = list(filter(None, l))
print(len(l))
for i in l:
	print(len(i), end=' ')


n = int(input())
s = input()
groups = s.split('W')
groups = [x for x in groups if x != '']
print(len(groups))
print(' '.join(list(map(lambda x: str(len(x)), groups))))


n = int(input())
s = input()
a = []
cnt = 0
count = 0
for i in range(n):
	if s[i] == 'B':
		cnt += 1
	else:
		if cnt != 0:
			count += 1
		if cnt != 0:
			a.append(cnt)
		cnt = 0
if s[-1] == 'B':
	a.append(cnt)
	count += 1
print(count)
for i in a:
	print(i, end=' ')
print()


m = int(input())
x = input() + ' '
k = 0
lst = []
for i in x:
	if i == 'B':
		k += 1
	elif k > 0:
		lst += [k]
		k = 0
print(len(lst))
print(*lst)


N = int(input())
S = [str(len(x)) for x in list(filter(None, input().split('W')))]
print(len(S))
print(' '.join(S))


class Main:

	def __init__(self):
		n = int(input())
		crossword = input()
		encrypt = []
		i = 0
		while i < n:
			count = 0
			while i < n and crossword[i] == 'B':
				count += 1
				i += 1
			if count != 0:
				encrypt.append(count)
			i += 1
		k = len(encrypt)
		print(k)
		print(*encrypt)
Main()


n = int(input())
s = input()
ret = []
for s1 in s.split('W'):
	if len(s1) > 0:
		ret.append(len(s1))
print(len(ret))
for m in ret:
	print(m, end=' ')


import sys, math
n = int(input())
z = input()
z += 'W'
ans = []
prev = 'W'
ctr = 0
for i in z:
	if i == 'B':
		if prev == 'W':
			ctr = 1
		else:
			ctr += 1
	elif prev == 'B':
		ans.append(ctr)
	prev = i
print(len(ans))
print(*ans)


row_size = int(input())
blocks = input()
if blocks.count('B') == row_size:
	print(1)
	print(row_size)
elif blocks.count('W') == row_size:
	print(0)
else:
	black_blocks = [str(len(i)) for i in blocks.split('W') if len(i) != 0]
	print(len(black_blocks))
	print(' '.join(black_blocks))


import re
n = int(input())
s = input()
print(len(re.findall('[B]{1,}', s)))
for item in re.findall('[B]{1,}', s):
	print(len(item), end=' ')


input()
b = [len(i) for i in input().split('W') if len(i) != 0]
print(len(b))
[print(i, end=' ') for i in b]


n = int(input())
str = input()
cntb = 0
cgroub = 0
lst = []
for i in range(len(str) - 1):
	if str[i] == 'B' and i != len(str) - 1:
		cntb += 1
		if str[i + 1] != 'B':
			cgroub += 1
			lst.append(cntb)
			cntb = 0
if str[len(str) - 1] == 'B':
	cntb += 1
	lst.append(cntb)
	cgroub += 1
print(cgroub)
print(*lst)


n = int(input())
ans = []
cnt = 0
for i in input().strip():
	if i == 'W' and cnt:
		ans.append(cnt)
		cnt = 0
	elif i == 'B':
		cnt += 1
if cnt:
	ans.append(cnt)
	cnt = 0
print(len(ans))
print(*ans)


num_chars = int(input())
seq = input()
groups = []
last_black = False
current_run_index = 0
for char in seq:
	if char == 'B':
		if last_black is False:
			groups.append(['B'])
			last_black = True
		else:
			groups[current_run_index].append('B')
	else:
		if last_black is True:
			current_run_index += 1
		last_black = False
print(len(groups))
out = ''
for group in groups:
	out += '%d ' % len(group)
print(out)


charNum = int(input())
string = input()
k = 0
res = ''
ans = string.split('W')
for i in range(len(ans)):
	if ans[i] != '':
		res += str(len(ans[i])) + ' '
		k += 1
if k > 0:
	print(k)
	print(res)
else:
	print(k)


num = int(input())
squares = list(input())
groups = 0
current = 'W'
lengths = []
this_length = 0
for square in squares:
	if square == 'B' and current == 'W':
		groups += 1
		this_length = 1
	elif square == 'B' and current == 'B':
		this_length += 1
	elif square == 'W' and current == 'B':
		lengths.append(str(this_length))
		this_length = 0
	current = square
if this_length != 0:
	lengths.append(str(this_length))
print(groups)
print(' '.join(lengths))


n = input()
table = input()
res = []
i = 0
for color in table + 'W':
	if color == 'B':
		i += 1
	elif color == 'W' and i > 0:
		res.append(str(i))
		i = 0
print(len(res))
if res:
	print(' '.join(res))


n = int(input())
s = input()
ans = []
i = 0
while i < n:
	if s[i] == 'B':
		cnt = 0
		while i < n and s[i] == 'B':
			i += 1
			cnt += 1
		ans.append(cnt)
	i += 1
print(len(ans))
print(*ans)


input()
i = [*map(len, filter(None, input().split('W')))]
print(len(i))
print(*i)


n = int(input())
s = input()
ans = []
k = 0
b = 0
for i in range(n):
	if s[i] == 'B':
		b += 1
		if i == n - 1:
			ans.append(b)
			k += 1
	elif s[i] == 'W':
		if b > 0:
			ans.append(b)
			k += 1
			b = 0
if k == 0:
	print(0)
else:
	print(k)
	print(' '.join(map(str, ans)))


n = int(input())
x = list(input().split('W'))
pas = [len(a) for a in x if len(a) > 0]
print(len(pas))
print(*pas)


def main():
	n = int(input())
	s = input()
	res = []
	k = 0
	for c in s:
		if c == 'B':
			k += 1
		elif k != 0:
			res.append(k)
			k = 0
	if k != 0:
		res.append(k)
	print(len(res))
	if len(res) == 0:
		return
	for i in range(len(res)):
		print(res[i], end=' ')
	print('')
main()


n = int(input())
word = input()
r = []
count = 0
for x in range(n):
	if word[x] == 'B':
		count = count + 1
	elif word[x] == 'W':
		if count:
			r.append(count)
		count = 0
if count:
	r.append(count)
if len(r):
	print(len(r))
	print(*r)
else:
	print(0)


n = int(input())
s = input()
ans = []
cur = 0
for i in range(n):
	if s[i] == 'B':
		cur += 1
	elif s[i] == 'W' and i != 0 and (s[i - 1] != 'W'):
		ans.append(cur)
		cur = 0
if s[-1] == 'B':
	ans.append(cur)
print(len(ans))
print(*ans)


n = int(input())
a = input()
b = []
count = 0
count1 = 0
j = 0
for i in range(0, n, 1):
	if i == n - 1 and a[i] == 'B':
		count += 1
		b.append(count)
		count = 0
		j += 1
		count1 += 1
	elif a[i] == 'B':
		count += 1
	elif count > 0:
		b.append(count)
		count = 0
		j += 1
		count1 += 1
print(count1)
for j in range(count1):
	print(b[j], end=' ')


n = int(input())
s = input()
if 'B' not in s:
	print(0)
else:
	count = []
	x = 0
	for i in s:
		if i == 'B':
			x += 1
		else:
			if x != 0:
				count.append(x)
			x = 0
	if x != 0:
		count.append(x)
	print(len(count))
	for i in count:
		print(i, end=' ')


n = int(input())
c = input()
d = []
flag = 0
count = 0
w = []
for i in range(len(c)):
	if c[i] == 'B':
		count += 1
		flag = 0
	else:
		if count > 0:
			w.append(count)
		count = 0
		flag = 1
if flag == 0:
	w.append(count)
print(len(w))
if len(w) != 0:
	print(*w)


x = int(input())
n = input()
k = 0
l = []
for i in range(x):
	if n[i] == 'B':
		k += 1
	else:
		l.append(str(k))
		k = 0
l.append(str(k))
p = l.count('0')
for i in range(p):
	l.remove('0')
print(len(l))
print(' '.join(l))


n = int(input())
a = list(input())
b = []
k = 0
flag = 0
for i in range(len(a)):
	if a[i] == 'B':
		k = k + 1
		flag = 1
	else:
		if k != 0:
			b.append(k)
		k = 0
	if i == len(a) - 1 and k != 0:
		b.append(k)
if flag == 1:
	print(len(b))
	for i in b:
		print(i, end=' ')
else:
	print(0)


input()
s = 0
L = []
for z in input():
	if 'B' == z:
		s += 1
	elif 0 < s:
		L.append(s)
		s = 0
if 0 < s:
	L.append(s)
print(len(L))
print(*L)


n = int(input())
s = list(filter(lambda x: x != '', input().split('W')))
print(len(s))
print(' '.join(map(lambda w: str(len(w)), s)))


n = int(input())
cw = list(input())
size = []
c = 0
i = 0
st = -1
while i <= n - 1:
	if cw[i] == 'B' and st == -1:
		c += 1
		st = i
	if cw[i] == 'W':
		if st != -1:
			size.append(i - st)
			st = -1
	if i == n - 1 and cw[i] == 'B':
		if st != -1:
			size.append(i - st + 1)
			st = -1
	i += 1
print(c)
for i in range(len(size)):
	print(size[i], end=' ')


a = [0]
i = input
i()
s = i()
for c in s:
	if c > 'B':
		a += [0]
	else:
		a[-1] += 1
a = list(filter(None, a))
print(len(a), *a)


(b, c, result) = (0, 0, [])
number = int(input())
data = list(input().strip())
for m in data:
	if m == 'B':
		b += 1
		c = 1
	elif m == 'W' and c == 1:
		result.append(b)
		b = 0
		c = 0
if b > 0:
	result.append(b)
l = len(result)
if l == 0:
	print(0)
else:
	print(l)
	for v in result:
		print(v, end=' ')


import logging
import copy
import sys
import math
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)

def solve(length, line):
	result = []
	for ch in line.split('W'):
		if ch != '':
			result.append(str(len(ch)))
	print(len(result))
	if len(result) > 0:
		print(' '.join(result))

def main():
	length = int(input())
	line = input()
	solve(length, line)

def log(*message):
	logging.debug(message)
main()


size = input()
line = input()
groups = []
group_started = False
current_group = -1
for symbol in line:
	if not group_started and symbol == 'B':
		current_group += 1
		groups.append(1)
	if group_started and symbol == 'B':
		groups[current_group] += 1
	group_started = symbol == 'B'
print(len(groups))
res = ' '.join([str(item) for item in groups])
print(res)


n = int(input())
line = input()
colour = 0
cipher = []
ind = 0
for col in line:
	if col == 'B':
		if colour == 0:
			colour = 1
			cipher.append(1)
		else:
			cipher[ind] += 1
	elif colour == 1:
		ind += 1
		colour = 0
print(len(cipher))
print(*cipher)


x = int(input())
y = input().upper()
l = list(filter(lambda x: x != '', y.split('W')))
c = [len(i) for i in l]
print(len(l))
print(' '.join(map(str, c)))


n = int(input())
a = list(map(str, input().split('W')))
b = []
for elements in a:
	if elements != '':
		b.append(len(elements))
print(len(b))
print(*b, end='')


import re
(_, b) = (input(), re.findall('[B]+', ''.join((i for i in input()))))
print(str(len(b)) + '\n' + ' '.join((str(len(i)) for i in b)))


n = int(input())
data = input()
answer = []
if data[0] == 'B':
	black = 1
else:
	black = 0
count = 0
for i in range(n):
	if data[i] == 'B':
		if black:
			count += 1
		else:
			black = 1
			count += 1
	elif black:
		answer.append(count)
		count = 0
		black = 0
if black:
	answer.append(count)
print(len(answer))
for element in answer:
	print(element, end=' ')


n = int(input())
s = input()
k = 0
num = 0
for i in range(n):
	if s[i] == 'W' and num > 0:
		k += 1
		num = 0
	elif s[i] == 'B':
		num += 1
if num > 0:
	k += 1
print(k)
num = 0
for i in range(n):
	if s[i] == 'W' and num > 0:
		print(num, end=' ')
		num = 0
	elif s[i] == 'B':
		num += 1
if num > 0:
	print(num)


input()
(s, count, x) = (input(), 0, [])
for c in s:
	if c == 'B':
		count += 1
	else:
		x.append(count)
		count = 0
x.append(count)
x = list(filter(lambda v: v > 0, x))
print(len(x))
print(' '.join(map(str, x)))


n = int(input())
cw = input()
g = 0
flag = True
flag1 = False
s = []
cont = 0
for i in range(n):
	if cw[i] == 'B' and flag:
		g += 1
		flag = False
	elif cw[i] == 'W':
		flag = True
	if cw[i] == 'B':
		cont += 1
		if i + 1 == len(cw):
			s.append(cont)
		flag1 = True
	elif cw[i] == 'W' and flag1:
		s.append(cont)
		cont = 0
		flag1 = False
print(g)
print(' '.join(map(str, s)))


n = int(input())
maps = input()
maps = maps.split('W')
total = 0
result = []
for letter in maps:
	if letter == '':
		continue
	total += 1
	result.append(len(letter))
print(total)
for i in result:
	print(i, end=' ')


input()
bgroups = [x for x in input().split('W') if x != '']
print(len(bgroups))
for i in bgroups:
	print(str(i.count('B')) + ' ', end='')


n = int(input())
a = input()
b = list()
total = 0
for i in range(0, n):
	if a[i] == 'B':
		total = total + 1
	elif total > 0:
		b.append(total)
		total = 0
if total > 0:
	b.append(total)
print(len(b))
if len(b) > 0:
	print(*b)


n = int(input())
s = input()
t = False
blocks = 0
output = ''
for i in s:
	if t == False and i == 'W':
		pass
	elif t == False and i == 'B':
		blocks = blocks + 1
		lblo = 1
		t = True
	elif t == True and i == 'W':
		output = output + str(lblo) + ' '
		lblo = 0
		t = False
	elif t == True and i == 'B':
		lblo = lblo + 1
if s[-1] == 'B':
	output = output + str(lblo) + ' '
print(blocks)
print(output)


input()
b = list(filter(lambda x: len(x) != 0, input().split('W')))
print(len(b), '\n', *map(lambda x: len(x), b))


input()
s = input()
con = 0
l = []
for i in s.split('W'):
	if len(i) > 0:
		l.append(str(len(i)))
		con += 1
print(con)
print(' '.join(l))


def Lang(s, x):
	i = 0
	b = []
	while i < x:
		if i < x and s[i] == 'B':
			count = 0
			while i < x and s[i] == 'B':
				count = count + 1
				i = i + 1
			b.append(count)
		elif i < x and s[i] == 'W':
			while i < x and s[i] == 'W':
				i = i + 1
	return b
x = int(input())
s = input()
res = Lang(s, x)
print(len(res))
print(' '.join(map(str, res)))


n = input()
foo = input()
out_arr = list(filter(None, foo.split('W')))
k = len(out_arr)
nums = []
for e in out_arr:
	nums.append(str(len(e)))
print(k)
print(' '.join(nums))


n = int(input())
arr = input()
ans = []
i = 0
for sym in range(n):
	if arr[sym] == 'B':
		i += 1
	elif i > 0:
		ans.append(i)
		i = 0
if i > 0:
	ans.append(i)
print(len(ans))
print(' '.join([str(t) for t in ans]))


n = int(input())
x = [i for i in input().split('W') if i]
print(len(x), '\n' + ' '.join(list((str(len(i)) for i in x))))


n = int(input())
b = input()
c = 0
t = []
i = 0
while i < n:
	if b[i] == 'B':
		j = i
		a = i
		c = 0
		while j < n:
			if b[j] == 'B':
				c = c + 1
			if b[j] == 'W':
				break
			j = j + 1
		t.append(c)
		i = a + c
	i = i + 1
print(len(t))
print(*t)


n = input()
s = input()
s += 'W'
count = 0
test = []
for i in s:
	if i == 'B':
		count += 1
	elif count != 0:
		test.append(count)
		count = 0
print(len(test))
print(' '.join(map(str, test)))


import re
n = int(input())
s = input()
matchs = re.findall('B+', s)
print(len(matchs))
if len(matchs):
	print(*[len(i) for i in matchs])
else:
	pass


def crossword(n, s):
	c = 0
	c1 = 0
	ls = []
	for i in range(n):
		h = 0
		if i == 0 and s[i] == 'B':
			c = c + 1
			h = 1
		elif s[i - 1] != 'B' and s[i] == 'B':
			c = c + 1
			h = 1
		if h == 1 and c1 > 0:
			ls.append(c1)
			c1 = 0
		if s[i] == 'B':
			c1 = c1 + 1
	if c1 > 0:
		ls.append(c1)
	print(c)
	if c == 1:
		print(c1)
	else:
		print(' '.join(map(str, ls)))
n = int(input())
s = str(input())
crossword(n, s)


n = int(input())
s = input()
bag = []
wflag = 0
bflag = 0
(w, b) = (0, 0)
for i in s:
	if i == 'B':
		if bflag == 1:
			b += 1
		else:
			b = 1
		bflag = 1
		wflag = 0
	else:
		if bflag:
			bag.append(b)
			b = 0
			wflag = 1
		bflag = 0
if bflag == 1:
	bag.append(b)
elif len(bag) == 0 and wflag == 0:
	bag.append(0)
	print(0)
	exit()
print(len(bag))
print(*bag)


n = int(input())
s = input().split('W')
res = []
for i in s:
	if 'B' in i:
		res.append(i)
r = []
for i in res:
	r.append(str(len(i)))
if len(r) != 0:
	print(len(r))
	print(' '.join(r))
else:
	print(0)


n = int(input())
s = str(input())
k = 0
l = []
ans = 0
ok = 0
cn = 0
t = 0
s += 'W'
n += 1
while k < n:
	if s[k] == 'B':
		cn += 1
		ok = 1
		k += 1
		continue
	if ok == 1:
		l.append(cn)
		t += 1
		ans += 1
		ok = 0
		cn = 0
	k += 1
print(ans)
print(*l)


x = int(input())
y = input()
m = 0
y += 'W'
for i in range(0, len(y) - 1):
	if y[i] == 'W' and y[i + 1] == 'B':
		m += 1
if y[0] == 'B':
	m += 1
print(m)
l = []
s = 0
if y[0] == 'B':
	s += 1
for o in range(0, len(y) - 1):
	if y[o] == 'W' and y[o + 1] == 'B':
		s += 1
	elif y[o] == 'B' and y[o + 1] == 'B':
		s += 1
	elif y[o] == 'B' and y[o + 1] == 'W':
		l.append(s)
		s = 0
for i in l:
	print(i)


n = int(input())
d = input()
s = 0
a = []
for i in range(n):
	if d[i] == 'B':
		s += 1
		if i == len(d) - 1:
			a.append(s)
	else:
		if s != 0:
			a.append(s)
		s = 0
print(len(a))
for i in range(len(a)):
	print(a[i], end=' ')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	s = S()
	r = []
	t = 0
	for c in s:
		if c == 'W':
			if t > 0:
				r.append(t)
				t = 0
		else:
			t += 1
	if t > 0:
		r.append(t)
	if len(r) == 0:
		return 0
	return '{}\n{}'.format(len(r), ' '.join(map(str, r)))
print(main())


k = input()
s = input().split('W')
a = []
for i in s:
	if 'B' in i:
		a.append(len(i))
print(len(a))
print(*a)


n = [int(i) for i in input().split()][0]
s = input().split()[0]
ctr = 0
a = []
flag = False
for i in range(n):
	if flag:
		if s[i] == 'B':
			a[ctr - 1] += 1
		else:
			flag = False
	elif s[i] == 'B':
		ctr += 1
		a.append(1)
		flag = True
print(ctr)
print(*a)


n = int(input())
s = str(input())
p = 0
s += '1'
arr = []
for i in s:
	if i == 'B':
		p += 1
	elif p != 0:
		arr.append(p)
		p = 0
print(len(arr))
for i in range(len(arr)):
	print(arr[i], end=' ')


number = int(input())
first = input()
gp = 0
second = []
counter = 0
for i in range(number):
	if first[i] == 'B':
		counter += 1
	elif counter > 0:
		gp += 1
		second.append(counter)
		counter = 0
if counter > 0:
	second.append(counter)
	gp += 1
print(gp)
print(*second)


n = int(input())
s = str(input())
res = []
i = 0
while i < len(s):
	(sum, j) = (0, i)
	while j < n and s[i] == s[j]:
		j += 1
		sum += 1
	if s[i] == 'B':
		res.append(sum)
	i = j
print(len(res))
for i in res:
	print(i, end=' ')


n = int(input())
s = input()
l = []
sp = s.split('W')
for a in sp:
	tmp = sum((1 if b == 'B' else 0 for b in a))
	if tmp != 0:
		l.append(tmp)
print(len(l))
if len(l) != 0:
	print(' '.join((str(a) for a in l)))


input()
s = input()
l = []
count = 0
for c in range(len(s)):
	if s[c] == 'B':
		count += 1
	elif c and s[c - 1] == 'B':
		l.append(count)
		count = 0
if count:
	l.append(count)
print(len(l))
for i in l:
	print(i)


n = int(input())
s = input()
R = []
cur = 0
for i in range(len(s)):
	if s[i] == 'B':
		cur += 1
	else:
		assert s[i] == 'W'
		if cur > 0:
			R.append(cur)
			cur = 0
if cur > 0:
	R.append(cur)
print(len(R))
print(' '.join(map(str, R)))


a = int(input())
s = [0]
s = input()
count = 0
dikkat = 0
for i in range(0, a):
	if i < a - 1:
		if s[i] == 'B' and s[i + 1] == 'W':
			dikkat += 1
	elif s[a - 1] == 'B':
		dikkat += 1
print(dikkat)
for i in range(0, a):
	if s[i] == 'B':
		count += 1
		if i < a - 1:
			if s[i] == s[i + 1]:
				continue
			else:
				print(count, end=' ')
				count = 0
		else:
			print(count)
	else:
		continue


import re

def main():
	input()
	string = input()
	res = [str(len(s)) for s in re.findall('B+', string)]
	print(len(res))
	print(' '.join(res))
main()


import re

def main():
	try:
		while True:
			input()
			a = list(map(len, [_f for _f in re.split('W+', input()) if _f]))
			print(len(a))
			print(*a)
	except EOFError:
		pass
main()


n = int(input())
s = [i for i in input().split('W') if i != '']
print(len(s))
print(' '.join(map(str, list(map(len, s)))))


from sys import exit
input()
t = [len(s) for s in input().replace('W', ' ').split()]
print(len(t))
print(' '.join((str(x) for x in t)))


n = int(input())
s = input()
(l, c, i) = ([], 0, 0)
while i < n:
	if s[i] == 'B':
		c += 1
		x = 0
		while i < n and s[i] == 'B':
			x += 1
			i += 1
		l.append(str(x))
	else:
		i += 1
print(c)
print(' '.join(l))


n = int(input())
r = input()
w = 0
p = str()
z = 0
for i in range(n):
	if r[i] == 'B':
		z += 1
	else:
		if z > 0:
			w += 1
		if z != 0:
			p += str(z) + ' '
		z = 0
if z != 0:
	w += 1
	p += str(z)
print(w)
if w != 0:
	print(p)


t = int(input())
s = input().split('W')
num = 0
ans = []
for i in s:
	if i == '':
		pass
	else:
		num += 1
		ans.append(i.count('B'))
print(num)
print(*ans)


from sys import exit
n = int(input())
v = []
s = input()
count = 0
for i in range(len(s)):
	if i == len(s) - 1 and s[i] == 'B':
		count += 1
		v.append(count)
	elif s[i] == 'B':
		count += 1
	elif s[i] == 'W' and s[i - 1] == 'B' and (i != 0):
		v.append(count)
		count = 0
if len(v) == 0:
	print('0')
	exit(0)
print(len(v))
print(' '.join((str(x) for x in v)))


n = int(input())
s = input()
cnt = 0
ans = []
for i in range(n):
	if i == 0 and s[i] == 'B' or 'B' == s[i] != s[i - 1]:
		cnt += 1
		cur = 1
		j = i + 1
		while j < n and s[j] == 'B':
			cur += 1
			j += 1
		ans.append(cur)
print(cnt)
print(' '.join(map(str, ans)))


input()
sp = list(input())
pr = []
if not 'B' in sp:
	print(0)
elif not 'W' in sp:
	print(1, len(sp), sep='\n')
else:
	t = 0
	for el in sp:
		if el == 'B':
			t += 1
		elif el == 'W' and t > 0:
			pr.append(t)
			t = 0
	if t > 0:
		pr.append(t)
	print(len(pr))
	print(*pr)


n = int(input())
row = input()
numbers = []
flag = False
currentNum = 0
for c in row:
	if c == 'B':
		if not flag:
			flag = True
		currentNum += 1
	else:
		flag = False
		if currentNum:
			numbers.append(str(currentNum))
			currentNum = 0
if currentNum:
	numbers.append(str(currentNum))
print(len(numbers))
print(' '.join(numbers))


n = int(input())
s = input().split('W')
while '' in s:
	s.remove('')
print(len(s))
for item in s:
	print(len(item), end=' ')


t = int(input())
s = input().split('W')
while '' in s:
	s.remove('')
print(len(s))
for i in s:
	print(len(i), end=' ')


n = int(input())
s = input()
t = 0
st = []
for i in s:
	if i == 'B':
		t += 1
	elif t > 0:
		st.append(t)
		t = 0
if t > 0:
	st.append(t)
print(len(st))
print(*st)


N = int(input())
S = input()
lst = []
left = right = 0
while right < len(S):
	while right < len(S) and S[right] == 'B':
		right += 1
	if S[left] == 'B':
		lst += [str(right - left)]
	while right < len(S) and S[right] == 'W':
		right += 1
	left = right
print(len(lst))
if lst:
	print(' '.join(lst))


n = int(input())
value = list(input())
l1 = []
b = 0
for item in value:
	if item == 'B':
		b += 1
	elif item == 'W':
		if b == 0:
			continue
		l1.append(b)
		b = 0
if b > 0:
	l1.append(b)
print(len(l1))
for item in l1:
	print(item, end=' ')


n = int(input())
res = [len(b) for b in input().split('W') if b != '']
if res:
	print(len(res))
	print(*res)
else:
	print(0)


i = input
n = int(i())
s = i()
a = []
Index = 0
Tol = 0
while Index < n:
	if s[Index] == 'B':
		Tol += 1
		Counter = 1
		Index += 1
		while Index < n and s[Index] == 'B':
			Index += 1
			Counter += 1
		a.append(Counter)
	Index += 1
print(Tol)
print(*a)


n = int(input())
d = input() + 'W'
res = 0
A = []
c = 0
for i in d:
	if i == 'W':
		if c > 0:
			A.append(c)
		c = 0
	else:
		c += 1
print(len(A))
print(' '.join([str(s) for s in A]))


n = input()
s = input()
a = s.split('W')
lst = []
for x in a:
	if len(x) > 0:
		lst.append(x)
print(len(lst))
for y in lst:
	print(len(y), end=' ')


n = int(input())
row = input()
i = 0
count = 0
test = []
while i < n:
	i = row.find('B', i)
	if i == -1:
		break
	if row.find('W', i) < 0:
		temp = row.count('B', i)
	else:
		temp = row.count('B', i, row.find('W', i))
	test.append(temp)
	i += temp
	count += 1
print(count)
print(*test)


import math
t = int(input())
s = str(input())
ans = []
k = 0
for i in range(t):
	if s[i] == 'B':
		k += 1
	else:
		if k != 0:
			ans.append(k)
		k = 0
if k != 0:
	ans.append(k)
print(len(ans))
for i in range(len(ans)):
	print(ans[i], end=' ')


n = int(input())
s = input()
count = 1
(length, l1) = ([], [])
if len(s) > 1:
	for i in range(1, len(s)):
		if s[i - 1] == s[i]:
			count += 1
		else:
			length.append((s[i - 1], str(count)))
			count = 1
	length.append((s[i], str(count)))
else:
	i = 0
	length.append((s[i], str(count)))
for i in range(len(length)):
	if length[i][0] == 'B':
		l1.append(int(length[i][1]))
print(len(l1))
print(*l1)


n = int(input().strip(' '))
square = input().strip(' ')
grp = 1
groups = {}
for i in square:
	if i == 'B':
		if f'{i}_{grp}' not in groups:
			groups[f'B_{grp}'] = 1
		else:
			groups[f'B_{grp}'] += 1
	if i == 'W':
		grp += 1
print(len(groups.keys()))
print(*list(groups.values()))


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)
(_, crossword) = (f_input(), f_input())
(prev_black, answer, count) = (-1, [], 0)
for i in range(len(crossword)):
	if crossword[i] == 'B' and prev_black == -1:
		prev_black = i
		continue
	if crossword[i] != 'B' and prev_black != -1:
		answer.append(int(i - prev_black))
		count += 1
		prev_black = -1
f_print(str(count) + '\n')
for i in answer:
	f_print(str(i) + ' ')


n = int(input())
a = input()
l = []
count = 0
count1 = 0
for i in range(n):
	if a[i] == 'B':
		count += 1
	elif count > 0:
		l.append(count)
		count = 0
	else:
		continue
if count > 0:
	l.append(count)
print(len(l))
print(*l)


length = int(input())
row = input()
answer = list()
plus = 0
for i in range(length):
	if row[i] == 'B':
		plus += 1
	elif plus != 0:
		answer.append(str(plus))
		plus = 0
if plus > 0:
	answer.append(str(plus))
print(len(answer))
print(' '.join(answer))


input()
s = [str(len(i)) for i in input().split('W') if i]
print(len(s))
print(' '.join(s))


n = int(input())
s = input()
count = 0
hasil = 0
array = []
array1 = []
for i in range(len(s)):
	if s[i] == 'B' and array == []:
		array += [i]
		hasil += 1
		count += 1
	elif s[i] == 'B' and array != []:
		count += 1
	if s[i] == 'W' or i == len(s) - 1:
		array = []
		if count > 0:
			array1 += [count]
			count = 0
print(hasil)
for i in array1:
	print(i, end=' ')


n = int(input())
x = input()
i = 0
l = []
while i < n:
	if x[i] == 'B':
		j = i
		while j < n and x[j] == 'B':
			j += 1
		l.append(j - i)
		i = j
	else:
		i += 1
print(len(l))
for k in l:
	print(k, end=' ')


(k, x) = (int(input()), 0)
(w, q) = (input(), [])
for i in range(k):
	if w[i] == 'W' and x != 0 and (w[i - 1] == 'B'):
		q.append(str(x))
		x = 0
	elif w[i] == 'B':
		x += 1
if x != 0:
	q.append(str(x))
print(len(q))
if len(q) != 0:
	print(' '.join(q))


length = int(input())
s = input() + '$'
groups = []
count = 0
for char in s:
	if char == 'B':
		count += 1
	elif count:
		groups.append(count)
		count = 0
print(len(groups))
print(*groups)


from itertools import groupby
total = input()
res = [str(len(list(g))) for (i, g) in groupby(input()) if i == 'B']
print(len(res))
print(' '.join(res))


n = int(input())
s = list(input())
res = []
i = 0
while i < n:
	j = i
	while j < n and s[j] == 'B':
		j += 1
	d = j - i
	if d > 0:
		res.append(d)
	i = j + 1
print(len(res))
print(' '.join(map(str, res)))


n = int(input())
a = input()
a += 'W'
k = 0
x = []
for i in range(n + 1):
	if a[i] == 'W':
		if k != 0:
			x.append(k)
		k = 0
	else:
		k += 1
print(len(x))
print(*x)


n = int(input())
s = input()
i = 0
j = 0
ans = []
while i < n:
	cnt = 0
	while i < n and s[i] == 'B':
		i += 1
		cnt += 1
	if cnt >= 1:
		ans.append(cnt)
	i += 1
print(len(ans))
for i in range(len(ans)):
	print(ans[i], end=' ')


n = int(input())
a = list(input().split('W'))
while '' in a:
	a.remove('')
print(len(a))
print(' '.join((str(len(i)) for i in a)))


n = int(input())
s = input()
cnt = 0
lst = []
b = False
i = 0
while i < len(s):
	run = 0
	if s[i] == 'B':
		cnt += 1
	while i < len(s) and s[i] == 'B':
		i += 1
		run += 1
	if run > 0:
		lst.append(run)
	i += 1
print(cnt)
out = ''
for e in lst:
	out += str(e) + ' '
print(out)


input()
data = input() + 'W'
count = 0
literal_count = []
so_far = 0
for i in data:
	if i == 'B':
		so_far += 1
	if i == 'W':
		if so_far != 0:
			literal_count.append(so_far)
			so_far = 0
			count += 1
print(count)
print(' '.join((str(lit) for lit in literal_count)))


n = input()
n = int(n)
m = input()
x = []
count = 0
concount = 0
for i in range(n):
	if m[i] == 'B':
		count += 1
	elif count is not 0:
		x.append(str(count))
		count = 0
		concount += 1
	if i == n - 1 and m[i] == 'B':
		x.append(str(count))
		concount += 1
print(concount)
s = ' '
s = s.join(x)
print(s)


m = int(input()) + 2
line = 'W' + input() + 'W'
len_B = 0
ans = []
len_e = 0
for i in range(1, m):
	if line[i] == 'B':
		if line[i - 1] == 'W':
			len_e = 1
			len_B += 1
		else:
			len_e += 1
	elif line[i - 1] == 'B':
		ans.append(len_e)
print(len_B)
print(*ans)


arr = []

def stringunia(stringuna):
	try:
		indx = stringuna.index('B')
		i = 0
		string = stringuna[indx:]
		while i < len(string):
			if string[i] != 'B':
				break
			i += 1
		arr.append(i)
		return stringunia(string[i + 1:])
	except ValueError:
		pass
	arr.append(len(arr))
	return arr
n = input()
s = input()
arr1 = stringunia(s)
print(arr1[-1])
for x in range(len(arr1) - 1):
	print(arr[x], end=' ')


n = [int(x) for x in input().split()]
s = input()
s += 'W'
(ind, cnt) = (0, 0)
r = []
while True:
	ind = s.find('B')
	if ind == -1:
		break
	cnt += 1
	s = s[ind:]
	ind2 = s.find('W')
	s = s[ind2:]
	r.append(ind2)
print(cnt)
for i in r:
	print(i, end=' ')


from sys import stdin

def main():
	(n,) = stdin_get_ints_from_line()
	line = stdin_get_string_from_line()
	l2 = line.split('W')
	res = []
	for x in l2:
		l = len(x)
		if l > 0:
			res.append(str(l))
	print(len(res))
	if len(res) > 0:
		print(' '.join(res))

def stdin_get_ints_from_line():
	return (int(x) for x in stdin.readline().strip().split(' '))

def stdin_get_ints_list_from_line():
	return list((int(x) for x in stdin.readline().strip().split(' ')))

def stdin_get_string_from_line():
	return stdin.readline().strip()
main()


k = int(input())
string = input()
a = []
cnt = 0
cnt_total = 0
ind = 0
for i in string:
	ind += 1
	if i == 'B':
		cnt += 1
		if ind == len(string):
			a.append(cnt)
			cnt_total += 1
	if i == 'W':
		if not ind == 1 and (not cnt == 0):
			a.append(cnt)
			cnt_total += 1
			cnt = 0
print(cnt_total)
print(*a, sep=' ')


N = int(input())
WTF = list(input())
WTF.append('W')
COUNTER = 0
T = list()
TMP = -1
while True:
	if WTF[TMP + 1:].count('B') > 0:
		TMP = WTF.index('B', TMP + 1)
		T.append(len(WTF[TMP:WTF.index('W', TMP + 1)]))
		TMP += T[len(T) - 1]
		COUNTER += 1
	else:
		break
print(COUNTER)
print(*T, sep=' ')


N = int(input())
S = input()
blist = []
flag = False
cnt = 0
for i in range(0, N):
	if flag:
		if S[i] == 'B':
			cnt += 1
		else:
			blist.append(cnt)
			flag = False
	elif S[i] == 'B':
		flag = True
		cnt = 1
if flag:
	blist.append(cnt)
print(len(blist))
if blist != []:
	ans = str(blist[0])
	for i in range(1, len(blist)):
		ans = ans + ' ' + str(blist[i])
	print(ans)


s = int(input())
line = input()
l = list(filter(None, line.split('W')))
count = len(l)
print(count)
l = map(len, l)
if count > 0:
	print(' '.join(map(str, l)))


length = int(input())
row = input()
numbers = []
n = 0
for x in row:
	if x == 'W' and n != 0:
		numbers.append(str(n))
		n = 0
	elif x == 'B':
		n += 1
if n != 0:
	numbers.append(str(n))
print(len(numbers))
print(' '.join(numbers))


input()
a = list(input())
s = []
d = 0
for i in a:
	if i == 'B':
		d += 1
	elif not d == 0:
		s.append(d)
		d = 0
if d != 0:
	s.append(d)
print(len(s))
for i in s:
	print(i, end=' ')


N = int(input())
st = input().strip().split('W')
st = [len(i) for i in st if len(i) > 0]
print(len(st))
for i in st:
	print(i, end=' ')


n = input()
s = input()
s += 'W'
group = []
black = 0
for i in s:
	if i == 'B':
		black += 1
	elif black:
		group.append(black)
		black = 0
print(len(group))
for i in group:
	print(i)


n = int(input())
s = list(input())
counte = 0
blockSizes = []
for i in range(len(s)):
	if i == n - 1 and s[i] == 'B':
		blockSizes.append(counte + 1)
	if i > 0 and i < n:
		if s[i] == 'B' and (s[i - 1] == 'B' or s[i - 1] == 'W'):
			counte += 1
		if s[i] == 'W' and s[i - 1] == 'B':
			blockSizes.append(counte)
			counte = 0
	elif s[i] == 'B':
		counte += 1
print(len(blockSizes))
if len(blockSizes) != 0:
	for i in range(0, len(blockSizes) - 1):
		print(blockSizes[i], end=' ')
	print(blockSizes[-1])


n = int(input())
s = input()
c = 0
l = 0
l1 = []
for i in range(n):
	if s[i] == 'B':
		c += 1
	elif c != 0:
		l += 1
		l1.append(c)
		c = 0
if c != 0:
	l += 1
	l1.append(c)
print(l)
for i in l1:
	print(i, end=' ')


input()
s = input()
res = []
i = 0
while i < len(s):
	if s[i] == 'W':
		i += 1
		continue
	j = i + 1
	while j < len(s) and s[j] == 'B':
		j += 1
	res.append(j - i)
	i = j
print(len(res))
print(*res)


n = int(input())
s = input()
k = s.split('W')
e = []
for i in k:
	if i != '':
		e.append(len(i))
print(len(e))
print(*e)


import sys
n = sys.stdin.readline()
cross = list(sys.stdin.readline())
groups = []
last = 'W'
for c in cross:
	if c == 'B':
		if last == 'B':
			groups[-1] += 1
		else:
			groups.append(1)
	last = c
print(len(groups))
if len(groups) > 0:
	print(*groups)


n = int(input())
s = input() + 'W'
res = []
sum = 0
for i in range(0, n + 1):
	if s[i] == 'B':
		sum += 1
	else:
		if sum > 0:
			res.append(sum)
		sum = 0
print(len(res))
for x in res:
	print(x, end=' ')


input()
l = list(input().split('W'))
f = 0
ans = []
for i in l:
	if len(i) > 0:
		ans.append(len(i))
print(len(ans))
print(*ans)


n = int(input())
strr = input()
i = 0
lst = []
cnt = 0
while i < n:
	if strr[i] == 'B':
		cnt += 1
	else:
		if cnt > 0:
			lst.append(cnt)
		cnt = 0
	i += 1
if cnt > 0:
	lst.append(cnt)
print(len(lst))
for i in lst:
	print(i, end=' ')


n = int(input())
groups = 0
count = 0
lengths = []
crossword = input()
for i in range(0, n):
	if crossword[i] == 'B':
		count += 1
	else:
		if count > 0:
			lengths.append(count)
			groups += 1
		count = 0
if count > 0:
	groups += 1
	lengths.append(count)
print(groups)
for i in lengths:
	print(i, end=' ')


n = int(input())
x = input()
c = x.count('BW')
if x[n - 1] == 'B':
	c += 1
print(c)
i = 0
if 'W' not in x:
	print(n)
	exit()
while i < n:
	if x[i] == 'B':
		for j in range(i + 1, n):
			if x[j] == 'W':
				print(j - i, end=' ')
				i = j
				break
	i += 1
if x[n - 1] == 'B':
	for i in range(n - 2, -1, -1):
		if x[i] == 'W':
			print(n - 1 - i)
			break


import re
pat = 'B{1,}'
n = int(input())
s = input()
ar = re.findall(pat, s)
print(len(ar))
print(' '.join([str(len(i)) for i in ar]))


row = int(input())
string = input()
consecutive = 0
group = 0
ans = []
for i in range(len(string) - 1):
	if string[i] == 'B':
		consecutive += 1
		if string[i + 1] == 'W':
			group += 1
			ans.append(consecutive)
			consecutive = 0
if string[-1] == 'B':
	consecutive += 1
	ans.append(consecutive)
	group += 1
print(group)
for i in ans:
	print(i, end=' ')


n = int(input())
s = input()
(arr, k) = ([], 0)
for i in range(len(s)):
	if s[i] == 'B':
		k += 1
	elif k > 0:
		arr.append(k)
		k = 0
if k > 0:
	arr.append(k)
print(len(arr))
print(*arr, sep=' ')


chars = input()
code = input()
i = 0
count = 0
a = []
while i < int(chars):
	if code[i] == 'B':
		count += 1
	if code[i] == 'W':
		if count > 0:
			a.append(count)
		count = 0
	i += 1
s = ''
if count > 0:
	a.append(count)
for x in a:
	s += str(x) + ' '
print(len(a))
print(s)


t = input
p = print
r = range
n = int(t())
s = t()
col = []
c = 0
for i in r(len(s)):
	if s[i] == 'B':
		c += 1
		if i == n - 1:
			col.append(c)
	else:
		if c != 0:
			col.append(c)
		c = 0
if sum(col) == 0:
	p(0)
else:
	p(len(col))
	p(' '.join(map(str, col)))


n = int(input())
s = input()
a = []
sum = 0
for i in range(len(s)):
	if s[i] == 'W':
		if sum > 0:
			a.append(sum)
			sum = 0
	else:
		sum += 1
	if i == len(s) - 1 and sum > 0:
		a.append(sum)
print(len(a))
for i in range(len(a)):
	print(a[i], end=' ')


n = int(input())
s = str(input())
l = []
e = 0
for i in range(0, len(s)):
	if s[i] == 'B':
		e = e + 1
	elif e > 0:
		l.append(e)
		e = 0
	else:
		pass
if e > 0:
	l.append(e)
print(len(l))
print(*l)


n = int(input())
a = ''
s = input().replace('W', ' ').split()
print(len(s))
if len(s) != 0:
	for i in s:
		a += str(len(i)) + ' '
print(a.rstrip())


a = input()
b = input()
d = 0
e = []
for i in b:
	if i == 'W' and d > 0:
		e.append(d)
		d = 0
	elif i == 'B':
		d += 1
if d != 0:
	e.append(d)
print(len(e))
for i in e:
	print(i, end=' ')


n = int(input())
(s, count, l) = (input(), 0, [])
s += 'W'
for i in range(0, len(s)):
	if s[i] == 'W':
		l.append(count)
		count = 0
		continue
	count += 1
(nl, c) = ([], 0)
for e in l:
	if e != 0:
		c += 1
		nl.append(e)
print(c)
if c != 0:
	print(*nl)


n = int(input())
a = input()
s = list(a)
sg = []
i = 0
while i < n:
	if s[i] == 'B':
		size = 1
		j = i + 1
		if j < n:
			while j < n and s[j] != 'W':
				size += 1
				j += 1
		sg.append(size)
		i += size
	else:
		i += 1
print(len(sg))
print(*sg)


import re

def main():
	try:
		while True:
			input()
			a = list(map(len, filter(None, re.split('W+', input()))))
			print(len(a))
			print(*a)
	except EOFError:
		pass
main()


from sys import stdin as fin
n = int(fin.readline())
line = tuple(fin.readline().strip())
cnt = lcnt = 0
ans = []
for char in line:
	if char == 'B':
		cnt += 0 if lcnt else 1
		lcnt += 1
	elif lcnt:
		ans.append(lcnt)
		lcnt = 0
if lcnt:
	ans.append(lcnt)
print(cnt)
print(' '.join((str(num) for num in ans)))


n = int(input())
l = input()
ma = 0
k = 0
lo = []
for i in range(n):
	if l[i] == 'B':
		ma = ma + 1
	else:
		k = k + ma
		if ma != 0:
			lo.append(ma)
		ma = 0
if l[n - 1] == 'B':
	lo.append(ma)
	k = k + ma
if k == 0:
	print(k)
else:
	print(len(lo))
	print(*lo)


a = input()
b = input()
ans = []
group_count = 0
item_count = 0
linestart = False
for i in b:
	if i == 'B' and (not linestart):
		group_count += 1
		item_count = 1
		linestart = True
	elif i == 'B' and linestart:
		item_count += 1
	elif i == 'W' and linestart:
		ans.append(item_count)
		linestart = False
if linestart:
	ans.append(item_count)
print(group_count)
print(str(ans).replace(',', ' ').replace('[', '').replace(']', ''))


input()
islands = [len(s) for s in input().split('W') if s]
if islands:
	print(len(islands))
	print(*islands)
else:
	print(0)


n = int(input())
s = input()
cnt = 0
lst = []
for i in range(len(s)):
	if s[i] == 'B':
		cnt = cnt + 1
	else:
		lst.append(cnt)
		cnt = 0
if s[-1] == 'B':
	lst.append(cnt)
a = [i for i in lst if i != 0]
print(len(a))
print(*a)


def main():
	n = int(input())
	words = input().split('W')
	count = 0
	for i in words:
		if 'B' in i:
			count += 1
	print(count)
	for i in words:
		if 'B' in i:
			print(len(i), end=' ')
main()


input()
v = [str(len(x)) for x in input().replace('W', ' ').split()]
print(len(v))
print(' '.join(v))


a = int(input())
b = list(input())
(count, c) = (0, [])
if b[-1] != 'W':
	b.insert(a, 'W')
for x in range(len(b)):
	if b[x] == 'B' and b.count('W') >= 1:
		count += 1
	elif b.count('B') == 0:
		break
	elif b.count('W') == 0:
		c.append(a)
		break
	else:
		if count != 0:
			c.append(count)
		count = 0
print(len(c))
[print(c[x], end=' ') for x in range(len(c))]


n = int(input())
a = input().split('W')
c = [len(i) for i in a if len(i) > 0]
print(len(c))
print(*c)


n = int(input())
crossword = list(input())
count = 0
res = []
for c in crossword:
	if c == 'B':
		count += 1
	elif count != 0:
		res.append(count)
		count = 0
if count != 0:
	res.append(count)
print(len(res))
for x in res:
	print(x, end=' ')


n = int(input())
s = input()
White = []
Cnt = []
s += 'W'
for i in range(len(s)):
	if s[i] == 'W':
		White.append(i)
Cnt.append(White[0])
for i in range(1, len(White)):
	Cnt.append(White[i] - White[i - 1] - 1)
ans = 0
for i in range(len(Cnt)):
	if Cnt[i] is not 0:
		ans += 1
print(ans)
for i in range(len(Cnt)):
	if Cnt[i] != 0:
		print(Cnt[i], end=' ')


n = int(input())
a = input()
l = list()
for i in range(0, n):
	if a[i] == 'B':
		l.append(i)
ans = list()
c = 1
for i in range(0, len(l)):
	if i < len(l) - 1 and l[i] == l[i + 1] - 1:
		c = c + 1
		continue
	elif c != 1:
		ans.append(c)
		c = 1
	else:
		ans.append(1)
z = len(ans)
ans = ' '.join(map(str, ans))
if l == []:
	print('0')
else:
	print(z)
	print(ans)


import re
n = int(input())
s = input()
l = re.findall('(B+)', s)
print(len(l))
for i in l:
	print(len(i), end=' ')


x = input()
raw_input = input().split('W')
clean_input = [_ for _ in raw_input if _ != '']
if clean_input:
	print(len(clean_input))
	for i in clean_input:
		print(len(i), end=' ')
else:
	print(0)


def solve(test):
	ans = []
	n = int(input())
	s = input() + 'W'
	tmp = 0
	for c in s:
		if c == 'B':
			tmp += 1
		else:
			if tmp > 0:
				ans.append(tmp)
			tmp = 0
	print(len(ans))
	print(*ans)
t = 1
for _ in range(t):
	solve(_ + 1)


input()
S = input()
K = list(filter(lambda x: x != '0', map(lambda x: str(len(x.replace('W', ''))), S.split('W'))))
print(len(K))
print(' '.join(K))


(_, s) = (input(), [len(el) for el in input().split('W') if len(el) > 0])
print(len(s))
print(*s)


n = int(input())
b = input().split(sep='W')
t = []
for i in range(len(b)):
	if b[i] != '':
		t.append(b[i])
t = list(map(str, map(len, t)))
print(len(t), ' '.join(t), sep='\n')


n = int(input())
s = input()
ans = [0] * n
dst = 0
last = 0
for i in range(n + 1):
	if i < n and s[i] == 'B':
		last += 1
	elif last:
		ans[dst] = last
		dst += 1
		last = 0
print(dst)
if dst:
	print(' '.join(map(str, ans[:dst])))


n = int(input())
a = [len(s) for s in input().split('W') if len(s) > 0]
print(len(a))
print(*a)


input()
string = input()
k = 0
out = []
state = True if string[0] == 'B' else False
size = 0
if state == True:
	k += 1
for i in string:
	newState = True if i == 'B' else False
	if newState == state and newState == True:
		size += 1
	if newState != state and newState == True:
		k += 1
		if size != 0:
			out.append(size)
		size = 1
	state = newState
out.append(size)
lis = ''
for i in out:
	lis += str(i) + ' '
print(k)
if k > 0:
	print(lis)


input()
sl = []
k = 0
for cell in input():
	if cell == 'B':
		k += 1
	elif k > 0:
		sl.append(str(k))
		k = 0
if k > 0:
	sl.append(str(k))
print(len(sl))
print(' '.join(sl))


_ = input()
arr = [str(len(x)) for x in input().replace('W', ' ').split()]
print(len(arr))
print(' '.join(arr))


a = []
cnt = 0
t = int(input())
s = input()
num = 0
q = 0
for i in s:
	if i == 'B':
		num += 1
		q = 1
	elif q:
		a.append(num)
		cnt += 1
		num = 0
		q = 0
if num:
	a.append(num)
	cnt += 1
print(cnt)
for i in range(0, cnt):
	print(a[i], end=' ')


n = int(input())
s = input()
n_black_group = 0
groups = []
count = 0
prev = ''
for (i, c) in enumerate(s):
	if c == 'B':
		count += 1
		if prev != 'B':
			n_black_group += 1
	if c == 'W' and prev == 'B':
		groups.append(count)
		count = 0
	prev = c
groups.append(count)
print(n_black_group)
if n_black_group:
	print(' '.join([str(x) for x in groups[0:n_black_group]]))


input()
l = [c for c in input()]
l.append('0')
l1 = []
c = 1
for i in range(len(l) - 1):
	if l[i] == 'B':
		if l[i + 1] == 'B':
			c += 1
			continue
		l1.append(c)
		c = 1
print(len(l1))
print(*l1)


inp = input
li = list
iinp = lambda : int(inp())
ent = lambda : map(int, inp().split())
lient = lambda : [int(i) for i in inp().split()]
li0 = lambda x: [0 for i in range(x)]
stent = lambda : [i for i in inp()]
k = iinp()
cadena = inp()
res = []
cont = 0
ban = False
if 'B' not in cadena:
	print(0)
else:
	for i in cadena:
		if i == 'B':
			cont += 1
			ban = True
		elif ban:
			ban = False
			res.append(cont)
			cont = 0
	if ban:
		res.append(cont)
	print(len(res))
	print(*res)


n = int(input())
out = [str(len(x)) for x in input().split('W') if x != '']
print(len(out))
print(' '.join(out))


input()
ans = [w for w in input().split('W') if w]
print(len(ans))
print(*[len(w) for w in ans])


N = int(input())
S = input()
i = 0
X = 0
L = []
while i < N:
	count = 0
	if S[i] == 'B':
		X += 1
		while i < N and S[i] == 'B':
			i += 1
			count += 1
		L.append(count)
	i += 1
print(X)
for x in L:
	print(x, end=' ')


t = int(input())
s = 'W' + input() + 'W'
l = []
L = []
for i in range(len(s)):
	if s[i] == 'W':
		l.append(i)
for i in range(1, len(l)):
	if l[i] - l[i - 1] != 1:
		L.append(l[i] - l[i - 1] - 1)
print(len(L))
print(*L, sep=' ')


a = int(input())
b = input()
counter = 0
ans = []
for i in range(0, a):
	if b[i] == 'B':
		counter += 1
	elif counter > 0:
		ans.append(counter)
		counter = 0
if counter > 0:
	ans.append(counter)
print(len(ans))
for j in range(0, len(ans)):
	print(ans[j], end=' ')


n = int(input())
s = input()
line = []
counter = 0
for i in range(n):
	if s[i] == 'B':
		counter += 1
	else:
		if counter > 0:
			line += [counter]
		counter = 0
if counter > 0:
	line += [counter]
if len(line) == 0:
	print(0)
else:
	print(len(line))
	print(' '.join(map(str, line)))


nb = int(input())
ls = input()
liste = [x for x in ls]
liste2 = []
compteur = 0
for loop in range(len(liste)):
	if liste[loop] == 'B':
		compteur += 1
	elif compteur != 0:
		liste2.append(str(compteur))
		compteur = 0
if compteur != 0:
	liste2.append(str(compteur))
print(len(liste2))
if len(liste2) != 0:
	print(' '.join(liste2))


N = int(input())
S = input()
L = []
P = 0
for k in S:
	if k == 'B':
		P += 1
	elif P > 0:
		L.append(P)
		P = 0
if P > 0:
	L.append(P)
W = len(L)
if W == 0:
	print(0)
else:
	R = ''
	R += str(L[0])
	for m in range(1, W):
		R += ' ' + str(L[m])
	print(W)
	print(R)


import os
import sys
import math
n = int(input())
crossword = str(input())
i = 0
flag = 0
ans = []
group = 0
ctr = 0
while i < len(crossword):
	if crossword[i] == 'B' and flag == 0:
		ctr += 1
		flag = 1
	elif crossword[i] == 'B' and flag == 1:
		ctr += 1
	elif crossword[i] == 'W':
		ans.append(ctr)
		ctr = 0
		flag = 0
	i += 1
if flag == 1:
	ans.append(ctr)
for x in range(0, len(ans)):
	if ans[x] != 0:
		group += 1
print(group)
for x in range(0, len(ans)):
	if ans[x] != 0:
		print(ans[x], end=' ')
print()


n = int(input())
s = input()
count = 0
answer = ''
for i in range(n):
	if s[i] == 'W':
		if s[i - 1] == 'B' and i > 0:
			answer = answer + ' ' + str(count)
		count = 0
		continue
	count += 1
if count > 0:
	answer += ' ' + str(count)
print(answer.count(' '))
print(answer)


n = int(input())
s = input()
s.replace('W', ' ')
s.strip()
k = 0
c = []
for i in range(len(s)):
	if s[i] == 'B':
		k += 1
	else:
		if k != 0:
			c.append(k)
		k = 0
if k != 0:
	c.append(k)
print(len(c))
if len(c) != 0:
	print(' '.join(map(str, c)))


n = input()
puzzle = input().split('W')
puzzle = [x for x in puzzle if x]
print(len(puzzle))
if len(puzzle):
	for item in puzzle:
		print(len(item), end=' ')
	print()


input()
b = list()
cur = 0
for i in input():
	if i == 'W':
		if cur > 0:
			b.append(cur)
		cur = 0
	else:
		cur += 1
if cur > 0:
	b.append(cur)
print(len(b))
if len(b) > 0:
	for i in b:
		print(i, end=' ')


x = input()
x = int(x)
y = input()
y = list(y)
output = []
counter = 0
for letters in y:
	if counter != 0 and letters == 'W':
		output.append(counter)
		counter = 0
	if letters == 'B':
		counter += 1
if counter != 0:
	output.append(counter)
print(len(output))
for out in output:
	print(out, end=' ')


n = int(input())
a = input()
count = count1 = status = 0
b = []
for i in range(n):
	if a[i] == 'B':
		count += 1
		status = 1
	elif a[i] == 'W' and status == 1:
		b.append(count)
		count1 += 1
		count = status = 0
	if i == n - 1 and a[i] == 'B':
		b.append(count)
		count1 += 1
print(count1)
if count1 != 0:
	for i in range(len(b)):
		print(b[i], end=' ')


n = int(input())
ans = []
l = list(input())
k = 0
for x in l:
	if x == 'W':
		if k == 0:
			continue
		else:
			ans += [str(k)]
			k = 0
	else:
		k += 1
if k:
	ans += [str(k)]
print(len(ans))
print(' '.join(ans))


n = input()
s = input()
s = [i for i in s.split('W') if len(i) > 0]
print(len(s))
for i in s:
	print(len(i), end=' ')


n = int(input())
s = input()
r = s.replace('W', '0')
l = r.replace('B', '1')
if int(l[0]) == 1:
	sum = 1
else:
	sum = 0
for i in range(len(l) - 1):
	if int(l[i + 1]) - int(l[i]) > 0:
		sum += 1
print(sum)
(count, p) = (0, 0)
a = []
for i in range(len(l)):
	if count + int(l[i]) > count:
		p += 1
		if i == len(l) - 1:
			a.append(p)
	else:
		a.append(p)
		p = 0
p
for i in a:
	if i != 0:
		print(i, end=' ')


n = int(input())
A = input()
B = []
for i in A:
	B.append(i)
b = 0
w = 0
count = 0
C = []
for j in range(0, n):
	if B[j] == 'B' and j != n - 1:
		b = b + 1
	elif B[j] == 'W' and b != 0:
		C.append(b)
		b = 0
	elif B[j] == 'B' and j == n - 1:
		b = b + 1
		C.append(b)
print(len(C))
s = ''
for k in C:
	s = s + str(k) + ' '
print(s)


n = int(input())
characters = input() + ' '
black_groups = 0
blacks_in_a_row = 0
sizes = []
for char in characters:
	if char == 'B':
		blacks_in_a_row += 1
	elif blacks_in_a_row >= 1:
		black_groups += 1
		sizes.append(str(blacks_in_a_row))
		blacks_in_a_row = 0
if black_groups == 0:
	print(0)
else:
	print(black_groups)
	print(' '.join(sizes))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	s = S()
	s = s.split('W')
	l = []
	for x in s:
		if 'B' in x:
			l.append(len(x))
	if len(l) == 0:
		print(0)
		exit()
	print(len(l))
	print(' '.join([str(x) for x in l]))
main()


num_squares = int(input())
values = input()
answer = ''
counter = 0
row_counter = 0
for current_index in range(num_squares):
	if values[current_index] == 'B':
		counter += 1
	elif counter > 0:
		answer += str(counter) + ' '
		row_counter += 1
		counter = 0
if counter > 0:
	row_counter += 1
	answer += str(counter)
print(row_counter)
print(answer)


n = int(input())
s = str(input())
l = []
c = 0
x = 0
for i in range(0, len(s)):
	if s[i] == 'B':
		c = 1
	if s[i] == 'B' and c > 0:
		x += 1
	elif s[i] == 'W' and c > 0:
		l.append(x)
		x = 0
		c = 0
	if i == len(s) - 1 and s[i] == 'B':
		l.append(x)
print(len(l))
for i in range(0, len(l)):
	print(l[i], end=' ')


def Remove(s):
	a = []
	for i in range(len(s)):
		if len(s[i]) == 0:
			a.append(i)
	a.reverse()
	for i in a:
		del s[i]
	return s

def Print(s):
	print(len(s))
	for i in s:
		print(len(i), end=' ')
n = int(input())
s = list(map(str, input().split('W')))
s = Remove(s)
Print(s)


n = int(input())
s = input()
a = []
b = 0
for i in range(n):
	if s[i] == 'B':
		b += 1
	if s[i] == 'W' or i == n - 1:
		if b > 0:
			a.append(b)
			b = 0
if len(a) > 0:
	print(len(a))
	for i in a:
		print(i, end=' ')
else:
	print(0)


n = int(input())
s = input()
l = []
x = 0
for i in range(n):
	if s[i] == 'B':
		x += 1
	else:
		if x > 0:
			l.append(x)
		x = 0
if x != 0:
	l.append(x)
print(len(l))
for i in range(len(l)):
	print(l[i], '', end='')


n = int(input())
s = input()
count = 0
ans = []
for char in s:
	if char == 'B':
		count += 1
	else:
		if count != 0:
			ans.append(count)
		count = 0
if count != 0:
	ans.append(count)
print(len(ans))
if len(ans) != 0:
	print(*ans)


n = int(input())
s = input()
a = []
cnt = 0
flag = 1
for i in range(n):
	if s[i] == 'B':
		cnt += 1
	elif s[i] == 'W':
		if cnt > 0:
			a.append(cnt)
			cnt = 0
if s[n - 1] == 'B':
	a.append(cnt)
print(len(a))
print(*a)


n = int(input())
s = input()
import re
x = re.findall('B{1,}', s)
print(len(x))
for i in x:
	print(len(i), end=' ')


n = int(input())
s = input()
gor = []
if n == 1:
	if s == 'B':
		print(1, '\n1')
	else:
		print(0)
	exit(0)
if s[0] == 'W':
	j = -1
else:
	j = 0
	gor.append(1)
for i in range(1, n):
	if 'B' == s[i] != s[i - 1]:
		gor.append(1)
		j += 1
	elif s[i] == s[i - 1] == 'B':
		gor[j] += 1
print(len(gor))
print(*gor)


n = int(input())
col = [i for i in input()]
k = 0
l = []
ctr = 0
for i in range(n - 1):
	if col[i] == 'B':
		ctr += 1
	if col[i] == 'B' and col[i + 1] == 'W':
		l += [ctr]
		ctr = 0
		k += 1
if col[n - 1] == 'B':
	k += 1
	l += [ctr + 1]
print(k)
if l:
	print(' '.join([str(c) for c in l]))


n = int(input())
L = []
s = input()
count = 0
for i in s:
	if i == 'B':
		count += 1
	else:
		if count:
			L.append(count)
		count = 0
if count:
	L.append(count)
print(len(L))
print(*L)


x = int(input())
s = input()
c = 0
arr = []
for i in range(x):
	if s[x - 1] == 'W':
		if s[i] == 'B':
			c += 1
			if s[i + 1] == 'W':
				arr.append(c)
				c = 0
	elif s[i] == 'B':
		c += 1
		if i != x - 1:
			if s[i + 1] == 'W':
				arr.append(c)
				c = 0
		if i == x - 1:
			if s[i] == 'B':
				arr.append(c)
				c = 0
if arr == []:
	arr.append(0)
	print(*arr, sep=' ')
else:
	print(len(arr))
	print(*arr, sep=' ')


n = int(input())
s = input()

def search(pat, txt, q):
	d = 256
	M = len(pat)
	N = len(txt)
	i = 0
	j = 0
	p = 0
	t = 0
	h = 1
	li = list()
	for i in range(M - 1):
		h = h * d % q
	for i in range(M):
		p = (d * p + ord(pat[i])) % q
		t = (d * t + ord(txt[i])) % q
	for i in range(N - M + 1):
		if p == t:
			for j in range(M):
				if txt[i + j] != pat[j]:
					break
			j += 1
			if j == M:
				li.append(i)
		if i < N - M:
			t = (d * (t - ord(txt[i]) * h) + ord(txt[i + M])) % q
			if t < 0:
				t = t + q
	return li
l = search('B', s, 101)
count = 0
m = 0
lk = list()
for j in range(len(l)):
	if j != len(l) - 1 and l[j + 1] == l[j] + 1:
		count += 1
	else:
		m = m + 1
		lk.append(count + 1)
		count = 0
print(m)
for i in lk:
	print(i, end=' ')


input()
s2 = []
for el in [len(el) for el in input().strip().split('W')]:
	if el > 0:
		s2.append(str(el))
print(len(s2))
print(' '.join(s2))


n = int(input())
s = input()
b = 0
ans = []
for ch in s:
	if ch == 'W':
		if b > 0:
			ans.append(b)
		b = 0
	else:
		b += 1
if b > 0:
	ans.append(b)
print(len(ans))
ans_s = ''
for el in ans:
	ans_s += str(el) + ' '
print(ans_s)


input()
crossword = input()
total = 0
cons = 0
islands = []
for c in crossword:
	if c == 'B':
		cons += 1
	elif cons > 0:
		islands += [cons]
		cons = 0
		total += 1
if cons > 0:
	islands += [cons]
	total += 1
print(total)
for island in islands:
	print(island, end=' ')


from math import *
n = int(input())
s = input() + 'W'
c = ''
b = 0
black = []
for i in range(n + 1):
	if s[i] == 'B':
		b += 1
	else:
		if b != 0:
			black.append(b)
		b = 0
print(len(black))
if len(black) != 0:
	print(*black)


__author__ = 'Think'
n = int(input())
string = input()
total = 0
groups = []
current = 0
ingroup = False
for i in range(len(string)):
	if ingroup:
		if string[i] == 'B':
			current += 1
		else:
			groups.append(current)
			current = 0
			ingroup = False
	elif string[i] == 'B':
		ingroup = True
		current = 1
		total += 1
if current != 0:
	groups.append(current)
print(total)
if len(groups) > 0:
	print(groups[0], end='')
	for i in groups[1:]:
		print(' ', end='')
		print(i, end='')


n = int(input())
l = input()
r = []
f = False
for (i, c) in enumerate(l):
	if c == 'B':
		if f:
			r[-1] += 1
		else:
			r += [1]
		f = True
	else:
		f = False
print(len(r))
if r:
	print(' '.join((str(x) for x in r)))


n = int(input())
s = input().replace('W', ' ').split()
print(len(s))
for x in s:
	print(len(x), end=' ')


k = int(input())
g = input()
z = 0
list1 = []
b = 0
for _ in range(len(g)):
	if g[_] == 'B':
		b += 1
	elif g[_] == 'W':
		if b != 0:
			list1.append(b)
			b = 0
			z += 1
	if g[_] == 'B' and _ == len(g) - 1:
		list1.append(b)
		z += 1
list2 = [str(x) for x in list1]
print(z)
print(' '.join(list2))


s = int(input())
str = input()
t = []
for i in str:
	if i == 'W':
		t.append('-')
	else:
		t.append(i)
count = 0
arr = []
for i in t:
	if i == '-':
		if count != 0:
			arr.append(count)
		count = 0
	else:
		count += 1
if count != 0:
	arr.append(count)
print(len(arr))
for i in arr:
	print(i, end=' ')
print()


n = int(input())
s = input().split('W')
count = 0
for i in s:
	if i == '':
		count += 1
print(len(s) - count)
for i in range(len(s)):
	if s[i] != '':
		print(s[i].count('B'), end=' ')


n = int(input())
lt = list(input())
lt += 'W'
mas = []
k = 0
for i in lt:
	if i == 'B':
		k += 1
	if i == 'W':
		mas.append(k)
		k = 0
masM = []
for i in mas:
	if i != 0:
		masM.append(i)
print(len(masM))
if len(masM) != 0:
	print(' '.join(map(str, masM)))


n = int(input())
lines = input().split('W')
length = 0
for line in lines:
	if line:
		length += 1
print(length)
for line in lines:
	if line:
		print(len(line), end=' ')


n = int(input())
a = input()
b = []
r = 0
s = 0
if set(a) == {'W'}:
	print(0)
else:
	for i in a:
		if i == 'B':
			s += 1
		if i == 'W':
			if s != 0:
				r += 1
				b.append(s)
				s = 0
	if s != 0:
		r += 1
		b.append(s)
	print(r)
	print(*b)


n = int(input())
str = input()
index = 0
black_started = False
black_group_count = 0
while index < len(str):
	if black_started:
		if str[index] == 'B':
			index += 1
			continue
		elif str[index] == 'W':
			black_started = False
			index += 1
			continue
	if str[index] == 'B':
		black_started = True
		black_group_count += 1
	index += 1
print(black_group_count)
index = 0
b_count = 0
frequency = []
while index < len(str):
	if str[index] == 'W' and b_count == 0:
		index += 1
		continue
	if str[index] == 'B':
		b_count += 1
	if str[index] == 'W' and b_count != 0:
		frequency.append(b_count)
		b_count = 0
	index += 1
if b_count != 0:
	frequency.append(b_count)
if len(frequency) != 0:
	i = 0
	while i < len(frequency):
		if i != len(frequency) - 1:
			print(frequency[i], end=' ')
		else:
			print(frequency[i])
		i += 1


n = int(input())
s = input()
yo = list(s.split('W'))
ro = yo.count('')
for j in range(ro):
	yo.remove('')
print(len(yo))
for i in yo:
	print(len(i), end=' ')


import math, fractions
n = int(input())
s = str(input())
q = []
c = 0
for i in range(n):
	if s[i] == 'B':
		c += 1
		if i == n - 1:
			q.append(c)
	else:
		if c != 0:
			q.append(c)
		c = 0
print(len(q))
for x in q:
	print(x, end=' ')
print()


n = int(input())
s = input()
(i, c, ans) = (0, 0, 0)
l = list()
while i < n:
	if s[i] == 'B':
		ans += 1
		c = 1
		i += 1
		while i < n and s[i] == 'B':
			c += 1
			i += 1
		l.append(c)
	else:
		i += 1
print(ans)
for i in l:
	print(i, end=' ')


n = int(input())
x = input()
x += '$'
patterns = []
start = 0
while start != n:
	if x[start] == 'B':
		y = 'B'
		start += 1
		while start != n:
			if x[start] != 'B':
				break
			else:
				y += 'B'
				start += 1
		patterns.append(y)
	else:
		start += 1
print(len(patterns))
for i in patterns:
	print(len(i), end=' ')


input()
s = str(input())
a = []
(count_g, count_b) = (0, 0)
flag = True
for i in s:
	if i == 'B' and flag == True:
		count_g += 1
		count_b += 1
		flag = False
	elif i == 'W' and flag == False:
		a.append(count_b)
		count_b = 0
		flag = True
	elif i == 'B' and flag == False:
		count_b += 1
	else:
		pass
if flag == False:
	a.append(count_b)
print(count_g)
if count_g > 0:
	for i in a:
		print(i, end=' ')


n = int(input())
l = list(input())
c = 0
j = []
for i in range(n):
	if l[i] == 'B':
		c += 1
	else:
		j.append(c)
		c = 0
if c != 0:
	j.append(c)
print(len(j) - j.count(0))
for i in range(len(j)):
	if j[i] != 0:
		print(j[i], end=' ')


n = int(input())
s = input()
k = 0
ans = []
for i in s:
	if i == 'W':
		if k:
			ans.append(k)
			k = 0
	else:
		k += 1
if k:
	ans.append(k)
	k = 0
print(len(ans))
print(*ans)


length = int(input())
str1 = input().replace('W', ' ')
list1 = [v for v in str1.split()]
print(len(list1))
ans = ''
for i in range(len(list1) * 2):
	if i % 2 == 0:
		ans += str(len(list1[i // 2]))
	else:
		ans += ' '
print(ans)


n = int(input())
s = input()
s = list(s)
bl = ''
t = 0
y = False
l = 0
for i in range(n):
	if s[i] == 'B':
		y = True
		t += 1
	if y:
		if s[i] == 'W' or i == n - 1:
			l += 1
			bl += str(t) + ' '
			t = 0
			y = False
print(l)
print(bl[:-1])


a = int(input())
b = input()
che = 0
c = 0
h = 0
ka = ''
for i in b:
	if i == 'B':
		c = c + 1
	elif i == 'W' and c > 0:
		ka = ka + str(c) + ' '
		c = 0
		h = h + 1
	che = che + 1
	if che == len(b) and i != 'W':
		ka = ka + str(c) + ' '
		c = 0
		h = h + 1
print(h)
print(ka)


n = int(input())
s = input()
seq = []
for (i, v) in enumerate(s):
	if v == 'B':
		if i == 0 or s[i - 1] == 'W':
			seq += [0]
		seq[-1] += 1
print(len(seq))
if len(seq) > 0:
	print(' '.join(map(str, seq)))


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

class PriorityQueue:

	def __init__(self, l=[]):
		self.q = l
		heapq.heapify(self.q)
		return

	def push(self, n):
		heapq.heappush(self.q, n)
		return

	def pop(self):
		return heapq.heappop(self.q)

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def main():
	N = Scanner.int()
	S = Scanner.string()
	ans = []
	cnt = 0
	for s in S:
		if s == 'B':
			cnt += 1
		elif cnt > 0:
			ans.append(cnt)
			cnt = 0
	if cnt > 0:
		ans.append(cnt)
	print(len(ans))
	if len(ans) > 0:
		print(*ans)
main()


num_squares = int(input())
color_squares = input()
if num_squares != len(color_squares):
	print('ERROR')
	exit()
else:
	Block_count = 0
	numB = 0
	counts = []
	for i in range(0, len(color_squares)):
		if color_squares[i] == 'B':
			numB += 1
			if numB == 1:
				Block_count += 1
			if i == len(color_squares) - 1:
				counts.append(numB)
		else:
			if numB > 0:
				counts.append(numB)
			numB = 0
	print(Block_count)
	print(' '.join(map(str, counts)))


n = int(input())
l = []
s = input()
q = s[0]
if q == 'B':
	l.append(1)
for i in range(1, len(s)):
	if s[i] != q:
		if q == 'W':
			l.append(1)
		q = s[i]
	elif s[i] == 'B':
		l[-1] += 1
print(len(l))
if len(l) != 0:
	print(*l, sep=' ')


input()
s = input() + 'W'
k = 0
l = []
for c in s:
	if c == 'B':
		k += 1
	elif k > 0:
		l += [k]
		k = 0
print(len(l))
if len(l) > 0:
	print(*l)


s = [str(len(i)) for i in __import__('re').findall('[B]+', [input() for _ in range(2)][1])]
print(len(s))
print(' '.join(s))


a = int(input())
b = input()
c = ''
d = []
for i in b:
	if i == 'b' or i == 'B':
		c += i
	elif len(c) != 0:
		d.append(len(c))
		c = ''
	else:
		c = ''
if 'b' in c or 'B' in c:
	d.append(len(c))
	c = ''
print(len(d))
for i in d:
	print(i, end=' ')


n = int(input())
a = 'W' + input() + 'W'
count = 0
lst = []
for ch in a:
	if ch == 'B':
		count += 1
	elif count:
		lst.append(count)
		count = 0
print(len(lst))
print(' '.join(map(str, lst)))


n = int(input())
s = str(input())
b = []
k = 0
j = 0
f = False
for i in s:
	if f or str(i) == 'B':
		f = True
		if str(i) == 'B':
			j += 1
		else:
			b.append(j)
			j = 0
			k += 1
			f = False
if j > 0:
	b.append(j)
	k += 1
print(k)
for m in b:
	print(m, end=' ')


n = int(input())
st = input()
groupnum = 0
groupsizes = []
curBrun = 0
index = 0
while index < len(st):
	while index < len(st) and st[index] == 'W':
		index += 1
	if index == len(st):
		break
	while index < len(st) and st[index] == 'B':
		curBrun += 1
		index += 1
	groupsizes.append(curBrun)
	curBrun = 0
print(len(groupsizes))
for i in range(len(groupsizes)):
	print(str(groupsizes[i]) + ' ', end='')


n = int(input())
string = input()
count = 0
count = []
subarray = 0
for i in range(len(string)):
	if string[i] == 'B':
		subarray += 1
	elif subarray != 0:
		count.append(subarray)
		subarray = 0
if string[-1] == 'B':
	count.append(subarray)
print(len(count))
if len(count) != 0:
	print(*count)


n = int(input())
s = input()
a = 0
r = []
for i in range(n):
	if s[i] == 'B':
		a += 1
	else:
		if a != 0:
			r.append(a)
		a = 0
if a != 0:
	r.append(a)
print(len(r))
if r:
	print(' '.join(map(str, r)))


input()
s = input()
res = []
counter = 0
for c in s:
	if c == 'B':
		counter += 1
	elif c == 'W':
		if counter > 0:
			res.append(counter)
		counter = 0
if counter > 0:
	res.append(counter)
print(len(res))
for r in res:
	print(r, end=' ')
print()


bgs = [0]
i = 0
n = int(input())
s = input()
for c in s:
	if c == 'B':
		bgs[i] += 1
	elif bgs[-1] != 0:
		bgs.append(0)
		i += 1
if bgs[-1] == 0:
	print(i)
	print(*bgs[:-1])
else:
	print(i + 1)
	print(*bgs)


_ = input()
arr = [str(len(i)) for i in input().replace('W', ' ').split()]
print(len(arr))
print(*arr)


n = int(input())
row = input()
ng = 0
gl = 0
ing = False
gs = []
for i in row:
	if i == 'W' and ing:
		gs.append(str(gl))
		gl = 0
		ing = False
	if i == 'B':
		if ing:
			gl += 1
		else:
			ng += 1
			gl = 1
			ing = True
if ing:
	gs.append(str(gl))
print(ng)
if ng > 0:
	print(' '.join(gs))


import sys
n = int(sys.stdin.readline())
s = str(sys.stdin.readline())
k = 0
start_state = False
len_k = []
for l in s:
	if l == 'B':
		if start_state:
			len_k[k - 1] += 1
		else:
			start_state = True
			k += 1
			len_k.append(1)
	else:
		start_state = False
print(k)
if k > 0:
	print(' '.join((str(e) for e in len_k)))


x = int(input())
y = input()
s1 = []
s = 0
k = 0
for i in range(x):
	if y[i] == 'B':
		s = s + 1
	if y[i] == 'W' or i == x - 1:
		if s != 0:
			k = k + 1
			s1.append(s)
			s = 0
print(k)
for i in range(len(s1)):
	print(s1[i], end=' ')


x = int(input())
y = input()
lst = []
b = 0
for i in range(x):
	if y[i] == 'B':
		b += 1
	elif y[i] == 'W':
		if b != 0:
			lst.append(b)
		b = 0
	if y[x - 1] == 'B' and x - 1 == i:
		lst.append(b)
if len(lst) != 0:
	print(len(lst))
	print(*lst)
else:
	print(len(lst))


n = int(input())
s = input() + 'W'
a = []
f = -1
if s[0] == 'B':
	f = 0
for i in range(1, n + 1):
	if s[i] == 'W' and f != -1:
		a += [i - f]
		f = -1
	elif f == -1 and s[i] == 'B':
		f = i
print(len(a))
print(*a)


(n, s, i, ar, x) = (int(input()), input(), 0, [], 0)
while i < n:
	if s[i] == 'B':
		x += 1
	elif x > 0:
		ar.append(x)
		x = 0
	i += 1
if x > 0:
	ar.append(x)
print(len(ar))
if len(ar) > 0:
	print(*ar)


def solve():
	n = int(input())
	s = input()
	cnt = 0
	ans = []
	for i in range(len(s)):
		if s[i] == 'B':
			cnt += 1
		elif cnt > 0:
			ans.append(cnt)
			cnt = 0
	if cnt > 0:
		ans.append(cnt)
	print(len(ans))
	if len(ans) == 0:
		return
	for i in range(len(ans) - 1):
		print(ans[i], end=' ')
	print(ans[-1])
solve()


input()
s = list(filter(lambda a: a != '', input().split('W')))
print(len(s))
d = ''
for i in s:
	d = d + ' ' + str(len(i))
print(d.strip())


n = int(input())
row = input()
k = 0
s = 0
size = []
if 'B' in row:
	start = row.index('B')
	for i in row[start:]:
		if i == 'B':
			s += 1
		elif s != 0:
			size.append(s)
			s = 0
	if i == 'B':
		size.append(s)
	print(len(size))
	for j in size:
		print(j, end=' ')
else:
	print(0)


n = int(input())
s = input().split('W')
a = []
b = []
for i in s:
	if i == '':
		continue
	else:
		a.append(i)
ans1 = len(a)
for i in a:
	b.append(len(i))
print(ans1)
ans2 = b
print(*ans2)


n = int(input())
a = input()
dp = [0] * n
for i in range(n):
	if a[i] == 'W':
		dp[i] = 0
	else:
		dp[i] = dp[i - 1] + 1
dp += [0]
ans = []
for i in range(n):
	if dp[i] != 0 and dp[i + 1] == 0:
		ans.append(dp[i])
print(len(ans))
print(*ans)


n = input()
str1 = input()
n = int(n)
pos = []
for i in range(n):
	if str1[i] == 'W':
		pos.append(i)
		i = i + 1

def dealpos(pos1, nx):
	pos2 = [0 for i in pos1]
	for i in range(len(pos1)):
		if i == 0:
			pos2[i] = pos1[i]
		else:
			pos2[i] = pos1[i] - pos1[i - 1] - 1
	if pos1[-1] < nx - 1:
		ny = nx - pos1[-1] - 1
		pos2.append(ny)
	return pos2
if not pos:
	print(1)
	print(n)
else:
	pos2 = dealpos(pos, n)
	pos3 = []
	for i in pos2:
		if i != 0:
			pos3.append(i)
	pos2 = pos3
	if not pos3:
		print(0)
	else:
		print(str(len(pos3)))
		anstr = str(pos2[0])
		for i in range(len(pos2)):
			if i != 0 and pos2[i] != 0:
				anstr = anstr + ' ' + str(pos2[i])
		print(anstr)


n = int(input())
flag = 0
count = 0
s = ''
s1 = list(input())
s1.append('W')
for i in range(n):
	if s1[i] == 'B' and s1[i + 1] == 'W':
		count += 1
	if s1[i] == 'B':
		flag += 1
		if s1[i + 1] == 'W':
			s = s + str(flag) + ' '
			flag = 0
print(count)
if count > 0:
	print(s)


n = int(input())
puzzle = input()
count = 0
total = 0
size = ''
check_previous = False
for i in range(0, len(puzzle)):
	if i == len(puzzle) - 1:
		if puzzle[i] == 'B':
			count += 1
			total += 1
			size += str(count)
		elif check_previous == True:
			total += 1
			size += str(count) + ' '
	elif puzzle[i] == 'B':
		count += 1
		check_previous = True
	elif puzzle[i] == 'W':
		if check_previous == True:
			total += 1
			check_previous = False
			size += str(count) + ' '
			count = 0
print(total)
print(size)


n = int(input())
s = [i for i in input()]
res = []
x = 0
for i in range(n):
	if i == n - 1:
		if s[i] == 'B':
			x += 1
			res.append(x)
		break
	else:
		if s[i] == 'B':
			x += 1
		if s[i] == 'B' and s[i + 1] == 'W':
			res.append(x)
			x = 0
			continue
print(len(res))
print(*res)


n = int(input())
s = input()[:n] + ' '
n = int(s[0] == 'B')
res = []
for i in range(1, len(s)):
	if s[i] == 'B':
		if s[i - 1] == 'B':
			n += 1
		else:
			n = 1
	elif s[i - 1] == 'B':
		res.append(n)
print(len(res))
if res:
	print(' '.join(map(str, res)))


n = int(input())
l = input()
i = 0
a = []
c = 0
b = 0
k = 0
while i < n:
	if 'B' not in l:
		print(0)
		k = 1
		break
	if l[i] == 'W':
		if b != 0:
			a.append(str(b))
			c += 1
			b = 0
	else:
		b += 1
	i += 1
if b != 0:
	c += 1
	a.append(str(b))
if k != 1:
	print(c)
	print(' '.join(a))


n = int(input())
s = input().strip()
l = []
b_cnt = 0
for idx in range(n):
	if s[idx] == 'W':
		if b_cnt > 0:
			l.append(b_cnt)
		b_cnt = 0
	elif s[idx] == 'B':
		b_cnt += 1
if b_cnt > 0:
	l.append(b_cnt)
print(len(l))
for i in l:
	print(i, end=' ')
print('')


n = int(input())
s = str(input())
x = s.split('W')
ans = ''
c = 0
for i in x:
	if len(i) >= 1:
		ans = ans + str(len(i)) + ' '
		c = c + 1
print(c)
print(ans)


a = int(input())
b = input()
r = 0
l = []
for i in range(a):
	if b[i] == 'B':
		r += 1
	elif r > 0:
		l.append(r)
		r = 0
if r > 0:
	l.append(r)
print(len(l))
for i in l:
	print(i, end=' ')


n = int(input())
string = input()
blacks_list = list()
ans = 0
for i in string:
	if i == 'B':
		ans += 1
	else:
		if ans != 0:
			blacks_list.append(ans)
		ans = 0
if ans:
	blacks_list.append(ans)
print(len(blacks_list))
print(*blacks_list)


l = int(input())
s = input().split('W')
j = []
for i in s:
	if len(i) > 0:
		j.append(len(i))
print(len(j))
print(' '.join((str(_) for _ in j)))


n = int(input())
s = str(input())
blocks = 0
current_size = 0
sizes = []
last = ''
for i in range(n):
	if i == 0 and s[i] == 'B':
		blocks += 1
		current_size += 1
	elif s[i] == 'B':
		if last == 'B':
			current_size += 1
		else:
			blocks += 1
			current_size = 1
	elif last == 'B':
		sizes.append(current_size)
	last = s[i]
if len(sizes) != blocks:
	sizes.append(current_size)
print(blocks)
if blocks != 0:
	print(*sizes)


print(*(lambda n, row: (lambda x: [len(x)] + x)([len(group) for group in [b for b in row.split('W') if len(b)]]))(int(input()), input()))


from sys import stdin
n = int(stdin.readline())
s = str(stdin.readline())
a = []
(f, c) = (1, 0)
for i in s:
	if i == 'B':
		c += 1
		f = 0
	elif f == 0:
		a.append(c)
		c = 0
		f = 1
if f == 0:
	a.append(c)
print(len(a))
for i in a:
	print(i, end=' ')


a = int(input())
st = input()
ans = list()
ans = st.split('W')
ans1 = list()
for char in ans:
	if len(char) == 0:
		pass
	else:
		ans1.append(len(char))
print(len(ans1))
for c in ans1:
	print(c, end=' ')


from itertools import groupby
N = int(input())
S = input()
groups = groupby(S)
ans1 = 0
ans2 = []
for (k, group) in groups:
	if k == 'B':
		ans1 += 1
		ans2.append(len(list(group)))
print(ans1)
if ans1 != 0:
	print(' '.join(map(str, ans2)))


n = int(input())
word = list(input())
counter = []
viz = [0] * n
for i in range(n):
	if word[i] == 'B':
		if viz[i] == 0:
			c = 1
			viz[i] = 1
			for j in range(i + 1, n):
				if word[j] == 'B':
					c += 1
					viz[j] = 1
				else:
					break
			counter.append(c)
print(len(counter))
if len(counter) > 0:
	print(*counter, sep=' ')


def s():
	n = int(input())
	a = input() + '.'
	c = 0
	r = []
	for i in a:
		if i == 'B':
			c += 1
		elif c > 0:
			r.append(c)
			c = 0
	print(len(r))
	print(*r)
s()


a = int(input())
s = list(input().split('W'))
print(len(s) - s.count(''))
for i in range(len(s)):
	if s[i] != '':
		print(len(s[i]), end=' ')


def main():
	number = input()
	letters = input()
	count = 0
	x = []
	for letter in letters:
		if letter == 'B':
			count += 1
		elif letter == 'W':
			if count != 0:
				x.append(count)
			count = 0
	if count != 0:
		x.append(count)
	print(len(x))
	for y in x:
		print(y, end=' ')
main()


n = int(input())
s = input()
n = 0
d = 0
l = []
c = True
for i in range(len(s)):
	if s[i] == 'B':
		if c:
			n += 1
		d += 1
		c = False
	if i == len(s) - 1 and s[i] == 'B' or s[i] == 'W':
		if not c:
			l.append(d)
			c = True
			d = 0
print(n)
for j in l:
	print(j, end=' ')


n = int(input())
s = list(input())
gr_lg = []
i = 0
while i < len(s):
	gr_cnt = 0
	while i < len(s) and s[i] == 'B':
		gr_cnt += 1
		i += 1
	if gr_cnt > 0:
		gr_lg.append(gr_cnt)
	i += 1
print(len(gr_lg))
for lg in gr_lg:
	print(lg, end=' ')


n = int(input())
s = input()
s = [str(len(i)) for i in s.split('W')]
while '0' in s:
	s.remove('0')
print(len(s))
print(' '.join(s))


n = int(input())
s = input()
cut = s.split('W')
while '' in cut:
	cut.remove('')
print(len(cut))
print(*[len(s) for s in cut])


n = int(input())
seq = input()
g = [0, 0]
b = 0
a = []
seq = seq.split('W')
for i in seq:
	if i != '':
		b += 1
		a.append(i.count('B'))
print(b)
res = ''
if b != 0:
	for i in range(len(a)):
		if i != len(a) - 1:
			res += str(a[i])
			res += ' '
		else:
			res += str(a[i])
	print(res)


(n, s, c, v) = (int(input()), input() + 'W', 0, [])
for ch in s:
	if ch == 'B':
		c += 1
	else:
		if c:
			v.append(str(c))
		c = 0
print(len(v))
print(' '.join(v))


input()
s = 'W' + input() + 'W'
ans = []
start = -1
for i in range(len(s)):
	if s[i] == 'B' and s[i - 1] == 'W':
		start = i
	elif s[i] == 'W' and s[i - 1] == 'B':
		ans.append(str(i - start))
print(len(ans))
print(' '.join(ans))


n = int(input())
s = input() + 'W'
out = []
last = 0
for i in s:
	if i == 'B':
		last += 1
	elif last > 0:
		out.append(str(last))
		last = 0
print(len(out))
if out:
	print(' '.join(out))


n = int(input())
s = input()
(ans, flag, c, arr) = (0, 0, 0, [])
for i in s:
	if i == 'B':
		if flag == 0:
			ans += 1
		flag = 1
		c += 1
	else:
		if c > 0:
			arr.append(c)
		flag = 0
		c = 0
if c > 0:
	arr.append(c)
if ans > 0:
	print(ans)
	for i in arr:
		print(i, end=' ')
else:
	print(0)


print((lambda s: '{}\n{}'.format(len(s), ' '.join(map(str, s))))([x for x in map(len, (input() * 0 + input()).split('W')) if x]))


def solve():
	n = int(input())
	stri = input()
	stri = stri.split('W')
	elem = []
	for element in stri:
		if 'B' in element:
			elem.append(element)
	print(len(elem))
	for x in elem:
		print(len(x), end=' ')
solve()


n = int(input())
arr = input()
count = 0
res = []
for elem in arr:
	if elem == 'W':
		res.append(count)
		count = 0
	else:
		count += 1
res.append(count)
res = list(filter(lambda x: x, res))
print(len(res))
print(' '.join((str(i) for i in res)))


n = int(input())
ans = [len(x) for x in input().split('W') if len(x)]
print(len(ans))
print(*ans)


def japanese(n, s):
	s += 'W'
	(lst, k) = (list(), 0)
	for i in range(n + 1):
		if s[i] == 'B':
			k += 1
		elif i and s[i - 1] == 'B':
			lst.append(k)
			k = 0
	return (len(lst), lst)
N = int(input())
t = input()
print(japanese(N, t)[0])
print(*japanese(N, t)[1])


n = int(input())
a = input() + 'W'
l = []
x = 0
for i in range(n + 1):
	if a[i] == 'B':
		x += 1
		continue
	if x > 0:
		l.append(x)
		x = 0
print(len(l))
if len(l) > 0:
	print(*l)


n = int(input())
s = input()
m = 0
c = 0
l = []
for i in range(n):
	if s[i] == 'B':
		m = m + 1
	else:
		if m > 0:
			l.append(m)
			c = c + 1
		m = 0
if s[n - 1] == 'B':
	l.append(m)
	c = c + 1
print(c)
if l:
	print(*l, sep=' ')


input()
a = str(input()) + 'D'
lst = []
c = 0
for i in a:
	if i == 'B':
		c = c + 1
	else:
		if c > 0:
			lst.append(c)
		c = 0
print(len(lst))
print(*lst)


n = int(input())
s = input()
s = s + 'W'
l = []
q = 0
for i in range(len(s)):
	if s[i] == 'B':
		q = q + 1
	else:
		if q != 0:
			l.append(q)
		q = 0
print(len(l))
for i in range(len(l)):
	print(str(l[i]) + ' ', end='')


n = int(input())
string = input()
string = string.split('W')
lst = []
cnt = 0
for i in string:
	if i == '':
		pass
	else:
		lst.append(len(i))
		cnt += 1
print(cnt)
for i in lst:
	print(i, end=' ')


input()
s = input()
l = [i for i in s.split('W') if i != '']
print(len(l))
print(*[len(i) for i in l], sep=' ')


n = int(input())
m = input()
k = 0
r = []
for i in range(len(m)):
	if m[i] == 'B':
		k += 1
	elif k != 0:
		r.append(k)
		k = 0
if k != 0:
	r.append(k)
print(len(r))
result = ' '.join((str(e) for e in r))
print(result)


import re
n = int(input())
s = input()
xl = re.findall('B+', s)
x = len(xl)
r = []
for i in xl:
	r.append(len(i))
print(x)
if x != 0:
	print(*r)


n = input()
s = input()
ans = []
sz = 0
for c in s:
	if c == 'B':
		sz += 1
	else:
		if sz > 0:
			ans.append(sz)
		sz = 0
if sz > 0:
	ans.append(sz)
print(len(ans))
print(*ans)


n = int(input())
a = input()
b = []
t = 0
for i in range(n):
	if a[i] == 'B':
		t += 1
		if i == n - 1:
			b.append(str(t))
	elif a[i] != 'B' and t != 0:
		b.append(str(t))
		t = 0
print(len(b))
print(' '.join(b))


row = int(input())
encrypt = input()
consecutive = []
groups = 0
cons = 0
i = 0
while i < row:
	while encrypt[i] == 'B':
		i += 1
		cons += 1
		if i == row:
			break
	else:
		i += 1
	if cons > 0:
		groups += 1
	if cons != 0:
		consecutive.append(str(cons))
	cons = 0
print(groups)
if groups != 0:
	print(' '.join(consecutive))


numberOfSquares = int(input())
squareValues = input()
numberOfOutput = 0
output = ''
lastCharacter = 'W'
lastCount = 0
for c in squareValues:
	if c == 'B':
		lastCount += 1
	elif lastCharacter == 'B':
		numberOfOutput += 1
		if output != '':
			output += ' '
		output += str(lastCount)
		lastCount = 0
	lastCharacter = c
if lastCharacter == 'B':
	numberOfOutput += 1
	if output != '':
		output += ' '
	output += str(lastCount)
print(str(numberOfOutput))
print(output)


num = int(input(''))
dat = str(input(''))
cou = 0
fin = []
for i in dat:
	if i == 'B':
		cou = cou + 1
		continue
	if i == 'W':
		if cou != 0:
			fin.append(cou)
			cou = 0
if cou != 0:
	fin.append(cou)
print(len(fin))
for i in fin:
	print(i, end=' ')


n = int(input())
str = input()
h = []
i = 0
while i < n:
	if str[i] == 'B':
		j = i + 1
		cnt = 1
		while j < n and str[j] == 'B':
			j += 1
			cnt += 1
		h.append(cnt)
		i = j
	else:
		i += 1
print(len(h))
for i in h:
	print(i, end=' ')


t = int(input())
s = str(input())
(i, ct) = (0, 0)
sz = []
while i < len(s):
	if s[i] == 'B':
		c = 0
		ct = ct + 1
		while i < len(s) and s[i] != 'W':
			c = c + 1
			i = i + 1
		sz.append(c)
	i = i + 1
print(ct)
for j in sz:
	print(j, ' ')


n = int(input())
k = input()
a = []
j = 0
i = 0
while j <= n - 1:
	if k[i] == 'B':
		if k[j] == 'W':
			a.append(j - i)
			i = j
		else:
			j += 1
	else:
		i += 1
		j += 1
if k[-1] == 'B':
	a.append(j - i)
print(len(a))
for i in a:
	print(i, end=' ')


(n, s) = (int(input()), input())
cnt = [0]
for c in s:
	if c == 'B':
		cnt[-1] += 1
	elif cnt[-1]:
		cnt.append(0)
if not cnt[-1]:
	cnt.pop()
print(len(cnt))
print(*cnt)


N = int(input())
L = input().split('W')
while True:
	try:
		L.remove('')
	except:
		break
print(len(L))
for x in L:
	print(len(x), end=' ')


n = int(input())
s = input()
l = 0
ll = 0
a = []
for i in range(len(s)):
	if s[i] == 'B':
		l = 1
		ll += 1
	if l == 1 and s[i] == 'W':
		l = 0
		a.append(ll)
		ll = 0
	if i == len(s) - 1 and ll > 0:
		a.append(ll)
print(len(a))
for i in a:
	print(i, end=' ')


def getin():
	xin = input()
	while xin.strip() == '':
		xin = input()
	return xin

def gi():
	return [int(x) for x in getin().split()]
input()
s = input()
ch = s[0]
i = 1
cur = 1 if ch == 'B' else 0
ans = []
while i < len(s):
	if s[i] == 'B':
		if ch == 'B':
			cur += 1
		else:
			cur = 1
	elif s[i] == 'W':
		if ch == 'B':
			ans.append(cur)
		cur = 0
	ch = s[i]
	i += 1
if cur > 0:
	ans.append(cur)
print(len(ans))
if len(ans) > 0:
	print(' '.join([str(x) for x in ans]))


n = int(input())
st = input() + ' '
answ = []
tmp = 0
for i in range(n + 1):
	if st[i] == 'B':
		tmp += 1
	elif tmp > 0:
		answ.append(tmp)
		tmp = 0
print(len(answ))
if len(answ) > 0:
	answ2 = [str(i) for i in answ]
	print(' '.join(answ2))


n = int(input())
s = input()
a = []
i = 0
c = 1
while i < n:
	if s[i] == 'B':
		if i != n - 1 and s[i + 1] == 'B':
			c += 1
		else:
			a.append(c)
			c = 1
	i += 1
print(len(a))
if len(a) != 0:
	print(*a)


n = int(input())
s = input()
nums = []
curr = 0
for i in range(n):
	if s[i] == 'B':
		curr += 1
	elif curr > 0:
		nums.append(curr)
		curr = 0
if curr > 0:
	nums.append(curr)
print(len(nums))
print(' '.join(map(str, nums)))


n = int(input())
string = input() + 'w'
res = []
r = 0
for i in range(n + 1):
	if string[i] == 'B':
		r += 1
	elif string[i - 1] == 'B':
		res.append(r)
		r = 0
print(len(res))
print(*res)


import sys, re
from itertools import product
from collections import Counter
ls = [l.rstrip() for l in sys.stdin.readlines()]
(n,) = map(int, ls[0].split(' '))
a = ls[1]
b = list(map(lambda x: len(x), re.split('W+', a)))
while 0 in b:
	b.remove(0)
print(len(b))
print(' '.join(map(str, b)))


def main():
	from sys import stdin, stdout
	n = int(stdin.readline())
	s = stdin.readline().strip().lower()
	l = []
	counter = 0
	for i in range(n):
		if s[i] == 'b':
			counter += 1
		elif counter:
			l.append(counter)
			counter = 0
	if counter:
		l.append(counter)
	if len(l):
		stdout.write(str(len(l)) + '\n')
		for i in l:
			stdout.write(str(i) + ' ')
	else:
		stdout.write('0')
main()


number = input()
string = [i for i in input().split('W') if i]
print(len(string), '\n' + ' '.join(list((str(len(i)) for i in string))))


n = int(input())
s = input()
res = []
for group in s.split('W'):
	if len(group) > 0:
		res.append(len(group))
print(len(res))
print(' '.join(map(str, res)))


n = int(input())
s = input()
s = s.split('W')
s = [len(x) for x in s if len(x)]
print(len(s))
print(*s)


length = int(input())
letters = input()
grupos = 0
lista_bs = ''
bs = 0
for i in range(length):
	if letters[i] == 'W':
		if bs == 0:
			continue
		else:
			grupos += 1
			lista_bs += str(bs) + ' '
			bs = 0
	else:
		bs += 1
		if i == length - 1:
			grupos += 1
			lista_bs += str(bs) + ' '
			bs = 0
print(grupos)
if grupos != 0:
	print(lista_bs)


n = int(input())
t = input().split('W')
s = ''
l = []
for i in t:
	if len(i) != 0:
		l.append(len(i))
print(len(l))
for i in l:
	if i != 0:
		s += str(i) + ' '
print(s)


a = int(input())
b = input() + 'W'
s = []
its = []
q = 0
itq = 0
for i in b:
	if i == 'B':
		itq += 1
	else:
		s.append(itq)
		if itq != 0:
			q += 1
		itq = 0
print(q)
for i in s:
	if i != 0:
		print(i, end=' ')


from sys import stdin
n = int(stdin.readline())
s = stdin.readline().strip().split('W')
s = [block for block in s if block != '']
print(len(s))
for block in s:
	print(len(block), end=' ')
if s:
	print()


n = int(input())
l = input()
squares = []
size = 0
for i in range(0, len(l), 1):
	c = l[i]
	if c == 'B':
		size += 1
	if c == 'W' or i == len(l) - 1:
		if size != 0:
			squares.append(size)
			size = 0
print(len(squares))
for i in squares:
	print(i, end=' ')


n = int(input())
a = ['W'] + list(input()) + ['W']
ans = []
c = 0
for i in range(1, n + 2):
	if a[i] == 'W' and a[i - 1] == 'B':
		ans.append(c)
		c = 0
	elif a[i] == 'B':
		c += 1
print(len(ans))
print(*ans)


n = int(input())
crossword = input()
count = 0
length_str = 0
result = []
for i in range(n):
	if crossword[i] == 'B':
		length_str += 1
	elif length_str > 0:
		count += 1
		result.append(length_str)
		length_str = 0
if length_str > 0:
	result.append(length_str)
	count += 1
print(count)
print(*result)


n = int(input())
BW = input().split('W')
while '' in BW:
	BW.remove('')
print(len(BW))
print(' '.join([str(len(bb)) for bb in BW]))


n = int(input())
stri = list(input())
ct = 0
list1 = []
for j in range(n):
	if stri[j] == 'B':
		ct += 1
	elif ct:
		list1.append(ct)
		ct = 0
if ct > 0:
	list1.append(ct)
print(len(list1))
for j in list1:
	if j:
		print(j, end=' ')


n = int(input())
s = input()
rex = []
p = []
k = 0
c = 0
for i in range(n):
	if s[i] == 'B':
		k = k + 1
		if i == n - 1:
			rex.append(k)
			c = c + 1
	elif s[i] != 'B':
		if k > 0:
			rex.append(k)
			c = c + 1
		k = 0
print(c)
for i in rex:
	print(i, end=' ')


n = int(input())
a = input().split('W')
ans = []
for s in a:
	if s != '':
		ans.append(len(s))
print(len(ans))
print(' '.join([str(i) for i in ans]))


n = input()
s = input().split('W')
n = 0
res = ''
for i in s:
	if len(i) > 0:
		n += 1
		res += '{} '.format(len(i))
print(n)
if res:
	print(res)


n = int(input())
s = input()
x = []
c = 0
for i in s:
	if i == 'B':
		c += 1
	elif c != 0:
		x.append(c)
		c = 0
if c > 0:
	x.append(c)
if len(x) > 0:
	print(len(x))
	print(*x)
else:
	print(0)


n = int(input())
s = input()
l = s.split('W')
cnt = 0
for i in l:
	if i is not '':
		cnt += 1
print(cnt)
for i in l:
	if i is not '':
		cnt += 1
		print(len(i), end=' ')


def same(a, b):
	return a == b

def black(c):
	return c == 'B'
n = int(input())
s = str(input())
count = 0
temp_size = 1
size = []
for i in range(n - 1):
	if same(s[i], s[i + 1]) and black(s[i]):
		temp_size += 1
		continue
	elif not black(s[i]):
		continue
	else:
		count += 1
		size.append(temp_size)
		temp_size = 1
if same(s[len(s) - 1], s[len(s) - 2]) and black(s[len(s) - 1]):
	size.append(temp_size)
	count += 1
elif not black(s[len(s) - 1]):
	pass
else:
	count += 1
	size.append(1)
print(count)
for i in size:
	print(i, end=' ')


n = int(input())
s = list(input())
freq = [0] * len(s)
(j, flag, ans, pointer) = (0, 0, 0, 0)
for i in range(len(s)):
	if s[i] == 'B':
		if pointer == 0:
			ans += 1
			freq[j] += 1
			flag = 1
			pointer = 1
		else:
			freq[j] += 1
			flag = 1
	else:
		pointer = 0
		if flag == 1:
			flag = 0
			j += 1
print(ans)
for i in freq:
	if i != 0:
		print(i, end=' ')


a = int(input())
b = input().split('W', -1)
while True:
	try:
		b.remove('')
	except:
		break
print(len(b))
for i in b:
	print(len(i), end=' ')


n = int(input())
s = input()
cnt = 0
l = []
for c in s:
	if c == 'B':
		cnt += 1
	elif cnt != 0:
		l.append(cnt)
		cnt = 0
if cnt != 0:
	l.append(cnt)
print(len(l))
print(*l, sep=' ')


n = int(input())
l = list(input())
ng = 0
l1 = []
co = 1
for i in range(n - 1):
	if l[i] == 'B' and l[i + 1] == 'W':
		l1.append(co)
		co = 1
		ng += 1
	elif l[i] == 'B':
		co += 1
if l[-1] == 'B':
	l1.append(co)
	ng += 1
print(ng)
print(*l1, sep=' ')


(n, s) = (input(), input())
a = list(filter(lambda x: len(x) > 0, s.split('W')))
print(len(a))
print(' '.join((str(len(x)) for x in a)))


n = int(input())
s = input()
x = 0
c = 0
l = []
while x < n:
	if s[x] == 'B':
		c += 1
	elif c:
		l.append(c)
		c = 0
	x += 1
if c:
	l.append(c)
print(len(l))
if l:
	print(*l)


n = int(input())
ans = 0
a = []
cnt = 0
OP = input()
for i in range(n):
	if OP[i] == 'W':
		if cnt:
			a.append(cnt)
			ans += 1
		cnt = 0
	else:
		cnt += 1
if cnt:
	a.append(cnt)
	ans += 1
print(ans)
print(' '.join(map(str, a)))


n = int(input())
x = input()
res = []
count = 0
for i in range(n):
	if x[i] == 'B':
		count += 1
		if i + 1 == n or x[i + 1] == 'W':
			res.append(count)
		else:
			continue
	if x[i] == 'W':
		count = 0
print(len(res))
if len(res) != 0:
	print(' '.join([str(i) for i in res]))


input()
s = input()
a = {}
count = 0
for i in range(len(s)):
	if s[i] == 'B':
		if count not in a.keys():
			a[count] = 1
		else:
			a[count] += 1
	else:
		count += 1
if len(a) == 0:
	print('0')
else:
	print(len(a))
	for i in a.keys():
		print(a[i], end=' ')


input()
s = input() + 'W'
cnt = 0
ans = []
for c in s:
	if c is 'W':
		if cnt > 0:
			ans.append(cnt)
			cnt = 0
	else:
		cnt += 1
print(len(ans))
print(' '.join(map(str, ans)))


n = int(input())
x = input()
array = [0] * (n + 1)
jlh = []
array[n] = 'W'
for i in range(n):
	array[i] = x[i]
hsl = 0
for i in range(n + 1):
	if array[i] == 'B':
		hsl += 1
	if array[i] == array[i - 1] and array[i - 1] == 'W':
		continue
	if array[i] != 'B':
		jlh += [hsl]
		hsl = 0
print(len(jlh))
for i in jlh:
	print(i, end=' ')


n = input()
l = input()
c = 0
a = []
for i in l:
	if i == 'W':
		if c != 0:
			a.append(c)
		c = 0
	else:
		c += 1
if c != 0:
	a.append(c)
print(len(a))
if len(a) > 0:
	print(' '.join((str(i) for i in a)))


n = int(input())
L = list(map(str, input()))
X = []
FLAG = 0
count = 0
for i in range(n):
	if L[i] == 'B':
		count += 1
		FLAG = 1
	else:
		if FLAG == 1:
			X.append(count)
		count = 0
		FLAG = 0
if count != 0:
	X.append(count)
print(len(X))
print(*X)


n = int(input())
crossword = input()
group_sizes = []
current_size = 0
for i in range(n):
	if crossword[i] == 'B':
		current_size += 1
	elif current_size != 0:
		group_sizes.append(current_size)
		current_size = 0
if current_size != 0:
	group_sizes.append(current_size)
print(len(group_sizes))
if len(group_sizes) != 0:
	print(' '.join(map(str, group_sizes)))


import re
x = int(input())
y = input()
a = 0
z = re.findall('B*', y)
for i in z:
	if 'B' in i:
		a += 1
	else:
		pass
print(a)
for i in re.findall('B*', y):
	if len(i) > 0:
		print(len(i), end=' ')
	else:
		pass


def main():
	n = int(input())
	s = input()
	ans = [0]
	for x in s:
		if x == 'W' and ans[-1] != 0:
			ans.append(0)
		elif x == 'B':
			ans[-1] += 1
	if ans[-1] == 0:
		ans.pop()
	if len(ans) == 0:
		print(0)
	else:
		print(len(ans))
		for c in ans:
			print(c, end=' ')
		print()
main()


n = int(input())
s = input()
flag = 'W'
k = ind = r = 0
p = []
for i in s:
	r += 1
	if i == 'B' and flag == 'W':
		k += 1
		ind += 1
		flag = 'B'
	elif i == 'B' and flag == 'B':
		ind += 1
	elif ind != 0:
		p.append(ind)
		flag = 'W'
		ind = 0
if ind != 0:
	p.append(ind)
print(k)
if k != 0:
	print(*p)


n = int(input())
s = input()
x = 0
y = 0
for i in range(n):
	if s[i] == 'B':
		x = x + 1
	else:
		if x > 0:
			y = y + 1
		x = 0
if x > 0:
	y = y + 1
x = 0
print(y)
for i in range(n):
	if s[i] == 'B':
		x = x + 1
	else:
		if x > 0:
			print(x, end=' ')
		x = 0
if x > 0:
	print(x)


_ = input()
s = input()
blocks = list()
block_len = 0
block = False
for x in s:
	if x == 'B':
		block_len += 1
		block = True
	else:
		if block_len != 0:
			blocks.append(block_len)
		block_len = 0
		block = False
if block:
	blocks.append(block_len)
print(len(blocks))
if len(blocks) > 0:
	print(' '.join(map(str, blocks)))


num = int(input())
inPut = input()
count = 0
some = 0
list = []
if 'B' not in inPut:
	print(0)
else:
	for i in range(num):
		if inPut[i] == 'B':
			count += 1
			some = 1
		if inPut[i] == 'W' and some == 1 or (i == num - 1 and count != 0):
			list.append(count)
			count = 0
			some = 0
	print(len(list))
	for num in list:
		print(num, end=' ')


x = int(input())
y = input()
win = []
match = []
p = 0
t = ''
for c in range(x):
	win.append(y[c])
for c in win:
	if c == 'B':
		p = p + 1
	elif p > 0:
		match.append(p)
		t = t + str(p) + ' '
		p = 0
if p > 0:
	match.append(p)
	t = t + str(p)
print(len(match))
if t != "' '":
	print(t)


n = int(input())
s = input()
k = 0
a = ''
c = 0
for i in s:
	if i == 'B':
		c += 1
	elif c > 0:
		k += 1
		a += str(c) + ' '
		c = 0
if i == 'B':
	k += 1
	a += str(c) + ' '
print(k)
if k > 0:
	print(a[:-1])


n = int(input())
l = list(input())
w = []
count = 0
for i in range(n):
	if l[i] == 'B':
		w.append(i)
m = []
for i in range(n + 1):
	if i in w:
		count += 1
	if i not in w:
		m.append(count)
		count = 0
s = m.count(0)
print(len(m) - s)
for i in range(len(m)):
	if m[i] > 0:
		print(m[i], end=' ')


class Node:

	def __init__(self, value):
		self.Value = value
		self.Next = None

def solve(n, str):
	a = []
	cnt = 0
	for c in str:
		if c == 'B':
			cnt += 1
		elif cnt > 0:
			a.append(cnt)
			cnt = 0
	if cnt > 0:
		a.append(cnt)
	return a
res = solve(int(input()), input())
print(len(res))
if len(res) > 0:
	print(str.join(' ', map(str, res)))


T_ON = 0
DEBUG_ON = 0
MOD = 998244353

def solve():
	n = read_int()
	s = input()
	G = []
	i = 0
	while i < n:
		while i < n and s[i] == 'W':
			i += 1
		j = i
		while j < n and s[j] == 'B':
			j += 1
		if j - i > 0:
			G.append(j - i)
		i = j
	print(len(G))
	if len(G):
		print_nums(G)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split()))

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def lcm(a, b):
	d = gcd(a, b)
	return a * b // d

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


input()
s = input()
a = []
t = 0
for i in s:
	if i == 'B':
		t += 1
	else:
		if t > 0:
			a.append(t)
		t = 0
if t > 0:
	a.append(t)
print(len(a))
if len(a) > 0:
	print(*a)


n = int(input())
s = input()
(A, c) = ([], 0)
for i in s:
	if i == 'B':
		c += 1
	else:
		if c:
			A.append(c)
		c = 0
if c:
	A.append(c)
print(len(A))
print(*A)


n = int(input())
s = input()
if 'B' in s:
	s = s.split('W')
	for i in range(len(s)):
		if '' in s:
			s.remove('')
		else:
			break
	print(len(s))
	for i in s:
		print(len(i), end=' ')
else:
	print(0)


def main():
	n = int(input())
	l = []
	s = 0
	for i in input():
		if i == 'B':
			s += 1
		elif s != 0:
			l.append(str(s))
			s = 0
	if s != 0:
		l.append(str(s))
	print(len(l))
	print(' '.join(l))
main()


n = int(input())
row = input()
k = []
cont = 0
inside = False
for letter in row:
	if inside:
		if letter == 'W':
			inside = False
			k.append(cont)
			cont = 0
		else:
			cont += 1
	elif letter == 'B':
		inside = True
		cont += 1
if cont > 0:
	k.append(cont)
print(len(k))
for num in k:
	print(num, end=' ')


n = int(input())
arr = input() + 'W'
k = 0
l = []
for c in arr:
	if c == 'B':
		k += 1
	elif k > 0:
		l += [k]
		k = 0
print(len(l))
if len(l) > 0:
	print(*l)


n = int(input())
p = input()
l = []
count = 0
for i in range(n):
	if p[i] == 'B':
		count += 1
	elif p[i] != 'B':
		if count > 0:
			l.append(count)
			count = 0
if p[-1] == 'B':
	l.append(count)
print(len(l))
print(*l)


n = int(input())
x = input()
l = []
c = 0
if x[0] == 'B':
	c = c + 1
	for i in range(1, len(x)):
		if x[i] == 'B':
			c = c + 1
		elif x[i - 1] == 'B':
			l.append(c)
			c = 0
		else:
			c = 0
	if x[-1] == 'B':
		l.append(c)
else:
	c = 0
	for i in range(1, len(x)):
		if x[i] == 'B':
			c = c + 1
		elif x[i - 1] == 'B':
			l.append(c)
			c = 0
		else:
			c = 0
	if x[-1] == 'B':
		l.append(c)
print(len(l))
for i in l:
	print(str(i), end=' ')


class Queue:

	def __init__(self):
		self.items = []

	def isEmpty(self):
		return self.items == []

	def enqueue(self, item):
		self.items.insert(0, item)

	def dequeue(self):
		return self.items.pop()

	def size(self):
		return len(self.items)
l = input()
x = input()
if 'B' not in x:
	print(0)
	exit()
k = 0
n = Queue()
z = Queue()
for i in range(len(x)):
	if x[i] == 'B':
		n.enqueue(x[i])
	elif x != 'B' and (not n.isEmpty()):
		z.enqueue(n.size())
		k = k + 1
		n = Queue()
if not n.isEmpty():
	k = k + 1
	z.enqueue(n.size())
print(k)
while not z.isEmpty():
	print(z.dequeue(), end=' ')


from sys import stdin

def read():
	return stdin.readline().strip()
n = int(read())
count = 0
k = 0
decryptList = []
encryptedList = list(read())
for i in range(len(encryptedList)):
	if encryptedList[i] == 'B':
		count += 1
	if encryptedList[i] == 'W' and count != 0:
		decryptList.append(count)
		count = 0
		k += 1
if count > 0:
	decryptList.append(count)
	k += 1
print(k)
print(*decryptList, sep=' ')


input()
s = input() + 'W'
l = []
st = ''
for k in s:
	if k == 'W':
		if len(st) != 0:
			l.append(len(st))
		st = ''
	else:
		st += 'B'
if len(l) == 0:
	print(0)
else:
	print(len(l))
	for k in l:
		print(k, end=' ')


z = 0
c = [0]
a = int(input())
s = str(input())
for i in range(a - 1):
	if s[i] != s[i + 1] and s[i] == 'W':
		z += 1
		c.append(0)
	if s[i] == 'B':
		c[z] += 1
if s[a - 1] == 'B':
	c[z] = c[z] + 1
if s[0] == 'W':
	c.pop(0)
print(len(c))
print(*c)


n = input()
inpt = input()
begin = -1
end = -1
i = 0
ans = []
for inp in inpt:
	if inp == 'W':
		if begin != -1 and end != -1:
			ans.append(end - begin + 1)
			begin = -1
			end = -1
	elif begin == -1 and end == -1:
		begin = i
		end = i
	else:
		end = i
	i += 1
if begin != -1 and end != -1:
	ans.append(end - begin + 1)
print(len(ans))
print(*ans)


n = int(input())
h = input()
h += '%*'
ans = []
c = 0
for i in range(n):
	try:
		if h[i] == 'B' and h[i] == h[i + 1]:
			c += 1
		if h[i] == 'B' and h[i + 1] == 'W':
			ans.append(c + 1)
			c = 0
		if h[i] == 'B' and h[i + 1] == '%':
			ans.append(c + 1)
			c = 0
	except:
		pass
if len(ans) == 0:
	print(0)
else:
	print(len(ans))
	print(*ans)


input()
c = list(input())
A = []
prev = c[0]
l = 0
if c[0] == 'B':
	l = 1
c.append('W')
for i in range(1, len(c)):
	if c[i] == 'B':
		l += 1
	elif c[i] == 'W' and c[i - 1] == 'B':
		A.append(l)
		l = 0
print(len(A))
if len(A) > 0:
	for x in A:
		print(x, end=' ')


n = int(input())
s = input()
i = 0
blackblock = []
while i < n:
	if s[i] == 'B':
		j = i
		while j < n and s[j] == 'B':
			j += 1
			if j == n or s[j] == 'W':
				blackblock.append(j - i)
				i = j
				break
	else:
		i += 1
print(len(blackblock))
for i in blackblock:
	print(i, end=' ')


n = int(input())
str = input()
ln = len(str)
i = 0
ans = []
while i < ln:
	if str[i] == 'B':
		cnt = 0
		while i < ln and str[i] == 'B':
			cnt += 1
			i += 1
		ans.append(cnt)
	i += 1
print(len(ans))
for c in ans:
	print(c, ' ', end='')


__author__ = 'artyom'

def main():
	n = read()
	s = read(0)
	r = []
	i = c = t = 0
	while i < n:
		if s[i] == 'B':
			c += 1
		elif c > 0:
			r.append(c)
			t += 1
			c = 0
		i += 1
	if s[-1] == 'B':
		r.append(c)
		t += 1
	write(t)
	if t > 0:
		write(r)

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='\n')
main()


n = int(input())
s = input().split('W')
count = 0
countArr = []
for x in s:
	if x == '':
		continue
	count += 1
	countArr.append(len(x))
print(count)
for x in countArr:
	print(x, end=' ')


input()
x = input().split('W')
y = [len(i) for i in x if len(i) > 0]
print(len(y))
print(*y)


n = int(input())
BW = input()
counter = 0
grp = 0
ingrp = []
for i in range(0, n):
	if BW[i] == 'B':
		counter += 1
	elif counter > 0:
		ingrp.append(counter)
		counter = 0
		grp += 1
if counter > 0:
	ingrp.append(counter)
	counter = 0
	grp += 1
final = ''
print(grp)
for i in range(0, grp):
	if final == '':
		final = str(ingrp[i])
	elif ingrp[i] != '':
		final = final + ' ' + str(ingrp[i])
if final != '':
	print(final)


n = int(input())
L = list(map(str, input()))
x = []
count = 0
f = 0
for i in range(n):
	if L[i] == 'B':
		count += 1
		f = 1
	else:
		if f == 1:
			x.append(count)
		count = 0
		f = 0
if count != 0:
	x.append(count)
print(len(x))
print(*x)


import sys
k = int(input())
s = list(sys.stdin.readline())
res = []
cnt = 0
for i in range(k):
	if s[i] == 'B':
		cnt += 1
	elif cnt != 0:
		res.append(str(cnt))
		cnt = 0
if cnt != 0:
	res.append(str(cnt))
l = len(res)
print(l)
if l == 0:
	exit()
print(' '.join(res))


import re
a = input()
string = input()
string = str(string)
Bregex = re.compile('[B]+')
mo = Bregex.findall(string)
print(len(mo))
for i in mo:
	print(len(i), end=' ')


import re
n = int(input())
s = input()
groups = re.compile('B+').findall(s)
results = [str(len(g)) for g in groups]
print(len(groups))
print(' '.join(results))


n = int(input())
s = input()
X = 0
new = True
L = []
for each in s:
	if each == 'W':
		new = True
		if X != 0:
			L.append(X)
			X = 0
	elif new:
		new = False
		X = 1
	else:
		X += 1
if not new and X != 0:
	L.append(X)
print(len(L))
print(*L)


n = int(input())
chars = list(input())
i = 0
prev = chars[0]
groups = []
group = 0
while i < len(chars):
	if chars[i] == 'B':
		group = 1 if prev == 'W' else group + 1
		prev = 'B'
	elif chars[i] == 'W' and prev == 'B':
		groups.append(group)
		group = 0
		prev = 'W'
	i += 1
if group > 0:
	groups.append(group)
print(len(groups))
if groups:
	print(' '.join([str(i) for i in groups]))


n = int(input())
s = list(input())
if s.count('B'):
	k = s.index('B')
else:
	print('0')
	exit(0)
g = 0
l = list()
while k < n:
	if s[k] == 'W':
		l.append(g)
		if s[k:].count('B'):
			k = s.index('B')
		else:
			break
		g = 0
	else:
		s[k] = 'W'
		g += 1
		if k == n - 1:
			l.append(g)
		k += 1
print(len(l))
for i in l:
	print(i)


import re
input()
a = [len(x) for x in re.split('[^B]', input()) if x]
print(len(a))
print(*a)


input()
s = [len(i) for i in input().split('W') if i]
print(len(s))
print(*s)


a = int(input())
b = str(input())
c = ''
k = 0
z = b[:1]
b += 'W'
p = 0
for i in b:
	if i == 'B':
		k += 1
	elif i != 'B' and k != 0:
		c += str(k) + ' '
		p += 1
		k = 0
print(p)
print(c[:-1])


x = input()
string = [len(x) for x in input().split('W') if len(x) > 0]
print(len(string))
print(*string)


n = int(input().strip())
s = input().strip()
i = 0
l = []
start = 0
while i < n:
	if s[i] == 'B':
		start = i
	else:
		i += 1
		continue
	while i < n and s[i] == 'B':
		i += 1
	l.append(i - start)
print(len(l))
if len(l):
	print(' '.join([str(x) for x in l]))


(n, s) = (input(), [str(len(el)) for el in input().split('W') if len(el) > 0])
print('{}\n{}'.format(len(s), ' '.join(s)) if len(s) else 0)


__author__ = 'goran'
N = int(input())
crossword = input()
size = 0
blocks = []
for c in crossword:
	if c == 'B':
		size += 1
	elif size > 0:
		blocks.append(size)
		size = 0
if size > 0:
	blocks.append(size)
print(len(blocks))
print(' '.join(map(str, blocks)))


n = int(input())
l = input()
c = 0
d = 0
b = []
for i in range(len(l)):
	if l[i] == 'B':
		c = c + 1
	if c > 0 and l[i] != 'B':
		d = d + 1
		b.append(c)
		c = 0
	elif i == len(l) - 1:
		if l[i] == 'B':
			d = d + 1
			b.append(c)
print(d)
for i in range(len(b)):
	print(b[i], end=' ')


n = int(input())
s = input()
a = []
for i in range(n):
	a.append(0)
check = 0
count = 0
ind = -1
for i in range(n):
	if s[i] == 'B' and check == 0:
		check = 1
		ind += 1
		count += 1
	elif s[i] == 'B' and check == 1:
		count += 1
	elif s[i] == 'W' and check == 1:
		check = 0
		a[ind] = count
		count = 0
if s[n - 1] == 'B':
	check = 0
	a[ind] = count
	count = 0
ind += 1
print(ind)
j = 0
for j in range(ind):
	print(a[j], end=' ')


input()
b = [i for i in input().split('W') if i != '']
print(len(b))
print(*[len(i) for i in b])


n = input()
a = input().split('W')
a = [C for C in a if C]
print(len(a))
if len(a):
	for b in a:
		print(len(b), end=' ')
	print()


n = int(input())
s = input().strip()
l = s.split('W')
ans = []
for i in l:
	if i:
		ans.append(str(len(i)))
print(len(ans))
print(' '.join(ans))


import re
I = lambda : map(int, input().split())
n = I()
s = input()
l = re.findall('(B+)', s)
print(len(l))
for i in range(len(l)):
	print(len(l[i]), end=' ')


a = int(input())
b = input()
c = []
s = 0
f = 0
n = 0
for i in range(a):
	if b[i] != n:
		if b[i] == 'B':
			s = 1
			n = 'B'
			f += 1
		else:
			n = 'W'
			if s != 0:
				c.append(s)
			s = 0
	elif b[i] == 'B':
		s += 1
if s != 0:
	c.append(s)
print(f)
if f != 0:
	for t in range(len(c)):
		print(c[t], end=' ')


n = input()
s = input()
count = 0
i = 0
while s[i] == 'W':
	i += 1
	if i == len(s):
		break
if i == len(s):
	print(0)
else:
	l = []
	while i < len(s):
		countB = 0
		while s[i] == 'B':
			i += 1
			countB += 1
			if i == len(s):
				break
		if s[i - 1] == 'B':
			count += 1
			l.append(countB)
		if i < len(s):
			while s[i] == 'W':
				i += 1
				if i == len(s):
					break
	print(count)
	for item in l:
		print(item, end=' ')


n = int(input())
s = input()
r = []
counter = 0
for val in s:
	if val == 'B':
		counter += 1
	elif counter != 0:
		r.append(counter)
		counter = 0
if counter != 0:
	r.append(counter)
print(len(r))
print(*r)


from sys import stdin

def read():
	return stdin.readline().strip()
read()
a = [len(i) for i in read().split('W') if i]
print(len(a), *a)


input()
s = input()
l = ''
ans = []
curL = 0
for c in s:
	if c == 'B':
		curL += 1
	if c == 'W':
		if l == 'B':
			ans += [curL]
			curL = 0
	l = c
if curL != 0:
	ans += [curL]
print(len(ans))
for a in ans:
	print(a, end=' ')


__author__ = 'Azad'
n = input()
l = input()
l = [x for x in l.split('W') if len(x)]
print(len(l))
l = [len(x) for x in l]
for x in l:
	print(x, end=' ')