Codeforces Round 374 (Div. 2)
A
One-dimensional Japanese Crossword
Codeforces
800
原题
←B →
翻译中…

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.

翻译中…

Note

翻译中…

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

翻译中…

样例

Input #1
3
BBW
Output #1
1
2
InputCopy OutputCopy
Input #2
5
BWBWB
Output #2
3
1 1 1
InputCopy OutputCopy
Input #3
4
WWWW
Output #3
0
InputCopy OutputCopy
Input #4
4
BBBB
Output #4
1
4
InputCopy OutputCopy
Input #5
13
WBBBBWWBWBBBW
Output #5
3
4 1 3
InputCopy OutputCopy
题目信息
题号
721A
时间限制
1 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。