#P1320. 压缩技术(续集版)

    ID: 317 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 1 上传者: 标签>模拟字符串洛谷原创概率论,统计

压缩技术(续集版)

Description

Suppose a Chinese character is composed of an N×NN \times N dot-matrix pattern of 0\texttt 0 and 1\texttt 1.

We generate a compression code according to the following rule. It is a sequence of consecutive counts: starting from the first symbol of the first row of the dot-matrix pattern, scan in writing order, left to right, top to bottom. The first number gives how many consecutive 0\texttt 0 there are, the second number gives how many consecutive 1\texttt 1 follow, the third number gives how many consecutive 0\texttt 0 follow, the fourth number gives how many consecutive 1\texttt 1 follow, and so on...

For example, the following dot-matrix pattern:

0001000
0001000
0001111
0001000
0001000
0001000
1111111

The corresponding compression code is: 7 3 1 6 1 6 4 3 1 6 1 6 1 3 7\texttt {7 3 1 6 1 6 4 3 1 6 1 6 1 3 7} (the first number is NN, and the remaining numbers alternately give the counts of 0\tt 0 and 1\tt 1; the compression code guarantees N×N=N \times N= the sum of these alternating counts).

Input Format

The character’s dot-matrix (no spaces between symbols).

Output Format

Output one line, the compression code.

0001000
0001000
0001111
0001000
0001000
0001000
1111111

7 3 1 6 1 6 4 3 1 6 1 6 1 3 7

Hint

It is guaranteed that 3N2003 \leq N \leq 200.

Translated by ChatGPT 5