Cyclic k-extension
Vasya recently discovered the concept of a cyclic k-extension of a string S. This is created by concatenating k copies of the string S and then taking the first k characters of this concatenated result.
Excited by this new knowledge, Vasya started applying this operation to a string he had, but he forgot which k value he used each time.
You are provided with a portion of the string that Vasya ended up with. Your task is to determine if Vasya could have correctly performed his transformations, meaning that the given substring could be part of a result derived from some original string he used.
Input
The first line of the input contains the original string that Vasya noted down before starting his transformations. The second line contains the substring of the result that Vasya obtained. Both strings are non-empty and have a maximum length of 5000 characters. The strings consist of uppercase and lowercase Latin letters (case-sensitive) and digits.
Output
Print "NO" if you can conclusively determine that Vasya made a mistake. Print "YES" if it is possible that he did not make a mistake.