ASCII Addition
Time limit1sMemory limit512 MB
Read the 7-row ASCII art of a plus b and print their sum in the same 7 by 5 digit art.
- Level
Easy3 of 10
- Topics
- Implementation, Matrix
- Solved
- No attempts yet
Problem
Some smartphone apps translate text and even solve equations when you point the camera at them. The task here is much simpler. Add two integers that are drawn as ASCII art.
An ASCII art is a matrix of characters that is exactly 7 rows high. Every character is either a dot (.) or the lowercase letter x.
An expression of the form is given, where and are positive integers. The expression becomes ASCII art this way. Every character of the expression, meaning each digit of and together with the + sign, is turned into a matrix, and consecutive matrices are joined horizontally with one column of dots between them. The matrices for the digits 0 to 9 and for the + sign are the following.
xxxxx ....x xxxxx xxxxx x...x xxxxx xxxxx xxxxx xxxxx xxxxx .....
x...x ....x ....x ....x x...x x.... x.... ....x x...x x...x ..x..
x...x ....x ....x ....x x...x x.... x.... ....x x...x x...x ..x..
x...x ....x xxxxx xxxxx xxxxx xxxxx xxxxx ....x xxxxx xxxxx xxxxx
x...x ....x x.... ....x ....x ....x x...x ....x x...x ....x ..x..
x...x ....x x.... ....x ....x ....x x...x ....x x...x ....x ..x..
xxxxx ....x xxxxx xxxxx ....x xxxxx xxxxx ....x xxxxx xxxxx .....
Given the ASCII art of an expression of the form , compute the sum and print it as ASCII art in the same format.
Input
The input has exactly 7 lines and holds the ASCII art of an expression of the form . Both and are positive integers with at most 9 decimal digits and no leading zeros.
Output
Print 7 lines with the ASCII art of the sum. Do not print leading zeros.