| Code Rush 2025 |
|---|
| Finished |
Paulino, while writing new problems, realized that he suffers from integer dyslexia. Paulino's integer dyslexia is very unusual because when he writes a sequence of numbers, he often starts with a different digit instead of the first one and then appends the skipped digits at the end. For example, he might write 123 as 231 or 312.
Given the correct number and the number that Paulino wrote, can you determine if they represent the same sequence?
The input consists of two numbers N and P, each with a maximum length of 100,000 digits. N is the correctly written number, and P is the one written by Paulino.
Print "YES" if the two numbers are the same; otherwise, print "NO" (without quotes).
123 231
YES
123 213
NO
| Name |
|---|


