URI Online Judge | 1236

Compressing Null and White

By Neilor Tonin, URI Brazil

Timelimit: 1

Francisco is a teacher and need your help to compress some text files. As the files contain basically white spaces and zeros (0), this program must be something very simple. The text contains only uppercase and lowercase letters, spaces and numbers. You must to consider the $ like a symbol for compression of spaces and the symbol # like a symbol to compress zeros. Remember 2 details:

To understand a little more, consider the following ASCII table: for example, CHR(3) means “ETX”


Note:

Input

The input contains many test cases. Each test case contains a number N that indicates the number of test cases. Each test case contains up to 2000 chars.

Output

Each input line must produce a output line, that is the compressed input, like example above

Sample Input Sample Output

3
124000000000000000000000000000000000002342340234Movimento
00                                      0TT
00f0a  s0                                            00 5

124##2342340234Movimento
00$&0TT
00f0a  s0$,00 5