시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 64 MB 259 168 154 66.094%

문제

아주 먼 옛날 수 억광년 떨어진 곳에서 두 정수 은하가 충돌한 것을 연정이가 최초로 발견했다. 

그런데 우리가 알고 있는 은하 충돌과 달리 두 정수 은하는 충돌하는 과정에서 동일한 위치에 존재하는 행성이 가지는 숫자가 더 작으면 해당 행성은 소멸한다. (단 숫자가 같은 경우에는 두 행성 모두 소멸하지 않는다) 길이가 다른 두 정수 은하가 충돌하는 경우, 가장 낮은 자리수의 행성끼리 충돌하고 다음으로 낮은 자리수의 행성끼리 충돌하는 식으로 일어난다.

두 정수 은하가 충돌한 뒤 각 은하에 남은 행성이 가지는 수를 공백없이 출력하시오.

입력

각 줄에는 첫 번째 은하가 가지는 행성의 집합 (N) 과 두 번째 은하가 가지는 행성의 집합 (M) 이 입력된다. (1 ≤ N, M ≤ 109)

출력

첫 줄에는 첫 번째 은하가 충돌한 결과를 두 번째 줄에는 두 번째 은하가 충돌한 결과를 출력하시오.

은하의 모든 행성이 소멸되었을 경우, 그 은하에 대해서 "YODA"를 출력해야 한다.

예제 입력 1

300
500

예제 출력 1

0
500

예제 입력 2

65743
9651

예제 출력 2

673
95

예제 입력 3

2341
6785

예제 출력 3

YODA
6785
W3sicHJvYmxlbV9pZCI6IjExODA5IiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiXHVjZGE5XHViM2NjIiwiZGVzY3JpcHRpb24iOiI8cD5cdWM1NDRcdWM4ZmMgXHViYTNjIFx1YzYxYlx1YjBhMCBcdWMyMTggXHVjNWI1XHVhZDExXHViMTQ0IFx1YjVhOFx1YzViNFx1YzljNCBcdWFjZjNcdWM1ZDBcdWMxMWMgXHViNDUwIFx1YzgxNVx1YzIxOCZuYnNwO1x1Yzc0MFx1ZDU1OFx1YWMwMCBcdWNkYTlcdWIzY2NcdWQ1NWMgXHVhYzgzXHVjNzQ0IFx1YzVmMFx1YzgxNVx1Yzc3NFx1YWMwMCBcd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