P29781 [洛谷] [COCI2015-2016#4] YODA
普及-
题目描述

Problem Description

Long, long ago, in a distant galaxy, a massive collision of integers was taking place.

Problem Description

What happens when two integers collide? First, prepend leading zeros to the number with fewer digits until it has the same number of digits as the number with more digits. Then, starting from the least significant digit, compare the corresponding digits of the two numbers and remove the smaller one (if the digits are equal, do nothing). Continue this process towards the most significant digit. At this point, concatenate the remaining digits of the two numbers in order to form two new numbers.

For example, for the numbers $456328$ and $284315$, the collision process is as follows:

$4$ $\sout{~5~}$ $6$ $3$ $2$ $8$
$\sout{~2~}$ $8$ $\sout{~4~}$ $3$ $\sout{~1~}$ $\sout{~5~}$

It is easy to see that the two new numbers after the collision are $46328$ and $83$.

Given two numbers $n$ and $m$, you are asked to find the new numbers resulting from their collision. If a number becomes empty after the collision, output the string YODA in its place. See the 'Output Format' section for specifics.

Input Format

The first line contains an integer $n$, the first number to be collided.
The second line contains an integer $m$, the second number to be collided.

Output Format

Output consists of two lines.

On the first line, if $n$ has become empty, output the string YODA; otherwise, output the integer resulting from the collision of $n$.
On the second line, if $m$ has become empty, output the string YODA; otherwise, output the integer resulting from the collision of $m$.

Sample Input and Output

Sample Input #1

300
500

Sample Output #1

0
500

Sample Input #2

65743
9651

Sample Output #2

673
95

Sample Input #3

2341
6785

Sample Output #3

YODA
6785

Notes

[Sample Explanation 2]

For Sample 2, the collision process is as follows:

$6$ $\sout{~5~}$ $7$ $\sout{~4~}$ $3$
$\sout{~0~}$ $9$ $\sout{~6~}$ $5$ $\sout{~1~}$

Thus, the two new numbers after the collision are $673$ and $95$.

[Data Range]

For $30\%$ of the data, $n$ and $m$ consist of three digits each.
For all data, $1 \leqslant n, m \leqslant 10^9$.

[Problem Source]

This problem is from COCI 2015-2016 CONTEST 4 T1 YODA, configured according to the original problem data, with a full score of $50$ points.

Provided by Eason_AC for translation and arrangement.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
300 500
样例输出
0 500