Title Description
NXN provided a Chinese character by the lattice pattern of 1 and 0 of the composition, as shown below. We generate compression code in accordance with the following rules. A continuous set of values: calculated from the first row of the first character dot-matrix pattern of a symbol, writing order from top to bottom, from left to right. Several consecutive first number indicates 0, the second number represents the next successive Several 1, then the next successive third number there are several 0, then the number of the fourth number of consecutive 1, so . . .
For example: The following Character dot pattern:
0001000
0001000
0001111
0001000
0001000
0001000
1111111
Corresponding compression code is: 731,616,431,616,137 (the first number is N, and the remaining bits represent the number indicates alternately 0 and 1, the number of codes to ensure that you alternate compression NXN = Sum)
Input Format
Bitmap characters (no spaces between the dot symbol). (3 <= N <= 200)
Output Format
Line, compressed code.
Sample input and output
0001000 0001000 0001111 0001000 0001000 0001000 1111111
7 3 1 6 1 6 4 3 1 6 1 6 1 3 7
1 #include<bits/stdc++.h> 2 using namespace std; 3 int d[40020],i=1; 4 char c; 5 int main() 6 { 7 for(;scanf("%c",&c)&&c>0x2F;) 8 i+=!(i&1^(c-0x30)),d[i]++,d[0]++; 9 for(;~scanf("%c",&c);)if(c>0x2F)i+=!(i&1^(c-0x30)),d[i]++; 10 for(int j=0;j<=i;j++)printf("%d ",d[j]); 11 }