CCC '02 J1 - 0123456789 (Hard)

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type
Canadian Computing Competition: 2002 Stage 1, Junior #1
 _     _  _       _   _  _   _   _
| | |  _| _| |_| |_  |_   | |_| |_|
|_| | |_  _|   |  _| |_|  | |_|  _|

Most digital devices show numbers using a seven segment display. The seven segments are arranged as shown:

 * * *
*     *
*     *
*     *
 * * *
*     *
*     *
*     *
 * * *

For this problem, each segment is represented by three asterisks in a line as shown above.

Any digit from 0 - 9 can be shown by illuminating the appropriate segments. For example, the digit 1 may be displayed using the two segments on the right side:

      *
      *
      *

      *
      *
      *

The digit 4 needs four segments to display it properly:

*     *
*     *
*     *
 * * *
      *
      *
      *

Input Specification

The first line contains a single integer, N (0 \le N \le 10^5).

On the next N lines, the i^\text{th} line will contain a non-empty string of digits s_i. It is possible for s_i to start with the digit 0.

The total length of all s_i will not exceed 10^5 digits.

Output Specification

For each s_i, display the digits using a seven segment display. Separate each digit with a single whitespace. None of your lines should contain any trailing whitespace.

Outputs for different s_i are separated by a blank line.

Sample Input

3
01
1
39

Sample Output

 * * *
*     *       *
*     *       *
*     *       *

*     *       *
*     *       *
*     *       *
 * * *


      *
      *
      *

      *
      *
      *


 * * *   * * *
      * *     *
      * *     *
      * *     *
 * * *   * * *
      *       *
      *       *
      *       *
 * * *   * * *

Comments

There are no comments at the moment.