The running length code is a kind of compression code of binary string. A running length code for a binary string is a sequence of bytes, where each byte (1 byte=8 bit) denotes a continuous part (continuous '0' or continuous '1') of the binary string, with the leftmost bit of the byte denoting the color of the part (0 or 1) and the other seven bits denoting the length of the part. Suppose that the length of any continuous part in a binary string is less than 128. Now given a binary string which length is less than 1000, write a program to encode it with the running length code.

The input contains a series of test cases, and each case consists of two lines. The first line of each test case is a single integer n (1<=n<1000), representing the length of a binary string. The following line represents the binary string, with one space separating every two bits of the binary string. The last test case is followed by a line containing one 0 that terminates the input.

提交代码