This page is still under construction.

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

YODA

Interview

Time limit1sMemory limit64 MB

Summary
Compare two numbers digit by digit from the right and drop the smaller digit at each position, printing YODA for a number left with no digits.
Level

Easy2 of 10

Topics
String, Simulation
Solved
No attempts yet

Problem

A long time ago in a galaxy far away, two integers are colliding. When two integers collide, their digits fight position by position. The positions line up at the right end: the ones digit meets the other ones digit, the tens digit meets the other tens digit, and so on.

Of the two digits that meet, the smaller one falls out of the number that contains it. If the digits are equal, nothing happens and both stay. If one number has no digit at that position, treat its digit as 0. A position that does not exist has no digit to lose.

After all positions have been compared, the digits still left in a number move together in their original order and form a new number. The new number is printed as a value, so leading zeros are dropped. For example, if the digits 0 and 0 are left, the value is 00.

Given two integers, write a program that determines their values after the collision. If every digit of a number has fallen out, print YODA for that number.

Input

The first line contains the first integer NN. (1≤N≤1091 \le N \le 10^9)

The second line contains the second integer MM. (1≤M≤1091 \le M \le 10^9)

Output

On the first line, print the value of the first integer after the collision.

On the second line, print the value of the second integer after the collision.

If every digit of a number has fallen out, print YODA on that line.

Examples3

  1. Example 1

    Input
    300
    500
    
    Expected output
    0
    500
    
  2. Example 2

    Input
    65743
    9651
    
    Expected output
    673
    95
    
  3. Example 3

    Input
    2341
    6785
    
    Expected output
    YODA
    6785