[BOJ 9791] Encoding Binary Numbers

View as PDF

Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 128M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

A binary number can be encoded into decimal digits by the following counting method.</p>

Binary number Counting Decimal digits
000 3x0 30
0111 1x0 3x1 1031
111000001 3x1 5x0 1x1 315011
1010 1x1 1x0 1x1 1x0 11101110
## 입력 형식

The input includes lines of a character string representing a binary number. The length of a binary number in each line is between 1 and 100 inclusive. The line containing only zero (0) indicates the end of the input. The last line must not be encoded into decimal digits. The input may contain up to 1,000 lines.

출력 형식

Print out in each line the decimal digits corresponding to the binary number. There is no space between digits.

예제 입력

111100000011
000
01010101
11
0

예제 출력

416021
30
1011101110111011
21

Comments

There are no comments at the moment.