This page is still under construction.

Parts of this page are still being built. What you see may change.

Count of Numbers 2

Interview

Time limit1sMemory limit128 MB

Summary
Multiply three positive integers and count how many times each digit 0 through 9 appears in the decimal representation of the product.
Level

Easy2 of 10

Topics
Math, Implementation, Array
Solved
No attempts yet

Problem

Given three positive integers A, B, and C, write a program that finds how many times each digit from 0 to 9 appears in the value of A × B × C.

For example, if A = 150, B = 266, and C = 427, then A × B × C = 150 × 266 × 427 = 17037300, and in the result 17037300 the digit 0 appears 3 times, the digit 1 appears 1 time, the digit 3 appears 2 times, and the digit 7 appears 2 times.

Input

A is given on the first line, B on the second line, and C on the third line. A, B, and C are all positive integers less than 1,000,000.

Output

On the first line, print how many times the digit 0 appears in the value of A × B × C. Likewise, from the second line through the tenth line, print how many times each digit from 1 to 9 appears in the value of A × B × C, one per line in order.

Examples3

  1. Example 1

    Input
    150
    266
    427
    
    Expected output
    3
    1
    0
    2
    0
    0
    0
    2
    0
    0
    
  2. Example 2

    Input
    1
    1
    1
    
    Expected output
    0
    1
    0
    0
    0
    0
    0
    0
    0
    0
    
  3. Example 3

    Input
    999999
    999999
    999999
    
    Expected output
    5
    0
    1
    0
    0
    0
    0
    1
    0
    11