#P12909. [NERC 2020] Japanese Game
[NERC 2020] Japanese Game
题目描述
Joseph really likes the culture of Japan. Last year he learned Japanese traditional clothes and visual arts and now he is trying to find out the secret of the Japanese game called Nonogram.
In the one-dimensional version of the game, there is a row of empty cells, some of which are to be filled with a pen. There is a description of a solution called a --- a sequence of positive integers denoting the lengths of consecutive sets of filled cells. For example, the profile of means that there are sets of four, three, and one filled cell, in that order, with at least one empty cell between successive sets.
A suitable solution for and .
A wrong solution: the first four filled cells should be consecutive.
A wrong solution: there should be at least one empty cell before the last filled cell.
Joseph found out that for some numbers and profiles there are lots of ways to fill the cells to satisfy the profile. Now he is in the process of solving a nonogram consisting of cells and a profile . He has already created a of --- he has filled all the cells that must be filled in every solution of the nonogram.
The mask for and : all the filled cells above are filled in every solution.
After a break, he lost the source profile . He only has and the mask . Help Joseph find any profile with the mask or say that there is no such profile and Joseph has made a mistake.
输入格式
The only line contains a string --- the mask of the source profile . The length of is (). The string consists of symbols and --- denoting filled and empty cells respectively.
输出格式
If there is no profile with the mask , output the number . Otherwise, on the first line, output an integer --- the number of integers in the profile . On the second line, output integers of the profile .
__#_____
2
3 2
_#
-1
___
0