Jonathan Sumabat 9.5

View as PDF

Submit solution

Points: 1
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Jonathan Sumabat is a world class Osu! player. He is known for developing new techniques to play that have been widely adapted across the game. One of these techniques is called hacking into Osu! servers and changing the score. This is where Jonathan Sumabat hacks into Osu! servers and changes his score. However, due to his limited access, the only option he has is to switch the first and last digits of his score. After changing a number of different scores, Jonathan Sumabat forgets which ones he changed, and which he didn't. Given the original score and the current score, determine if it is possible that the score was hacked. Keep in mind that other players are also hacking the game and changing his score, but they will only ever remove, add, or change digits in the middle and never at the start or end. If other players change the score, it will always occur before Jonathan Sumabat changes the score.

Input Specification

The first line of input contains n_i (1 \le n_i \le 10^9) representing the original score.
The second line of input contains n_f (1 \le n_f \le 10^9) representing the current score.

Output Specification

If Jonathan Sumabat could have hacked this score, print yes, otherwise print no.

Sample Input

4296
6394

Sample Output

yes

Explanation for Sample

Other players changed the hundreds digit in the score from 2 to 3, but only Jonathan Sumabat could have switched the 4 and the 6, therefore he hacked the score.


Comments

There are no comments at the moment.