Programming contests

Magas szintű programozási nyelvek 1, gyakorló feladatsor, 2012. február 20.

February 25, 2014 12:00 PM – April 10, 2014 12:00 AM

Digital Problem

Everything has become cheaper in the Widget Shop, so all the signs that show prices in the shop have to be replaced. You can buy new signs in the Digital Market: you can buy digits from '0' to '9' and you can put together the signs from these digits. Your task is to write a program that calculates how many digits you need from each type.

Input Specification

The input contains several blocks of test cases. Each case begins with a line containing an integer 1 ≤ n ≤ 1000, the number of signs that you have to install. Each sign contains only one price (an integer between 1 and 1 000 000). The next n lines contain one number each: they describe the prices on the signs.

The input is terminated by a block with n = 0.

Output Specification

For each test case, you have to output 10 integer numbers, separated by spaces. These numbers describe how many digits you need from each type: the first number is the number of 0's you have to buy, the last number is the number of 9's you need.

Sample Input

  1. 2
  2. 101
  3. 250
  4. 1
  5. 99999
  6. 0
download as text file

Output for Sample Input

  1. 2 2 1 0 0 1 0 0 0 0
  2. 0 0 0 0 0 0 0 0 0 5
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019