最近Adaltik发现了日本的填字游戏。日语填字游戏是一幅图画,表示为一个大小为a×b的方格表,每个方格都被染成白色或黑色。在行的左边和列的上面有整数,对相应的行或列进行加密。整数的数量代表对应行或列有多少组黑色方块,而整数本身代表对应组中连续的黑色方块的数量(你可以在维基百科https://en.wikipedia.org/wiki/Japanese_crossword,找到更详细的解释)。
Adaltik认为日本填字游戏的一般情况太复杂了,于是画了一个由n个方块组成的行(例如日本填字游戏的大小为1×n),他想用与日本填字游戏相同的方法对其进行加密。
日本填字游戏单行加密的例子。帮助Adaltik找到他画的那一行的加密数字。
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.
The example of encrypting of a single row of japanese crossword. Help Adaltik find the numbers encrypting the row he 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.