Hide

Problem E
Match Game

Match sticks can be used to form digital numbers. The arrangement of matches that forms each digit between ‘0’ and ‘9’ is illustrated in the figure.

/problems/matchgame/file/statement/en/img-0001.jpg

You are given two sequences of digits $X$ and $Y$. There are matches that have been arranged to form the digits in $X$. Can you move exactly one match from them, so that the resulting matches form the other sequence $Y$?

Input

The input contains one line with two sequences of digits $X$ and $Y$. It is guaranteed that $X$ and $Y$ have the same length but are different sequences. Each sequence contains digits between ‘0’ and ‘9’ and has at least one and no more than $12$ digits. A sequence may contain leading zeros.

Output

Output “yes” if it is possible to move exactly one match to change $X$ into $Y$. Otherwise output “no”.

Sample Input 1 Sample Output 1
60 58
yes
Sample Input 2 Sample Output 2
046 040
yes
Sample Input 3 Sample Output 3
1178 1140
no

Please log in to submit a solution to this problem

Log in