By Tiago Zonta, Unoesc Brazil
In 2013, FACE Fair compressed their visitors data with a free zipper. Unfortunately, this tool started to be paid and you were asked to create an algorithm to unzip the data. The data are compressed in a decimal format, and in order to run the unzipped you are asked to find each compressed line checksum. FACE organization got a documentation of how the process worked, but some information on how to get the digits are not clear, the document only provides some examples, as follow:
The input contains several test cases. A test case first line contains an integer N (1 ≤ N ≤ 25), representing the visitors data number from that file, wherein, each line represents a visitor. The following N lines consist of K digits (1 ≤ K ≤ 103) without space representing the compacted line. The stop is given by N equals 0.
For each compacted line you must display the uncompressed checksum digit.
Sample Input | Sample Output |
5 |
7 |