#K45902. Rotation String Check

    ID: 27856 Type: Default 1000ms 256MiB

Rotation String Check

Rotation String Check

Given two strings s and t, determine whether t can be obtained by rotating s any number of times. A rotation means moving some prefix of s to the end of the string. Formally, for a string s with length \(n\), one rotation moves characters so that if \(s = s_0s_1\ldots s_{n-1}\), a rotation may produce \(s_i s_{i+1} \ldots s_{n-1} s_0 s_1 \ldots s_{i-1}\) for some \(0 \le i < n\).

Note: If \(|s| \neq |t|\), output "No" immediately.

You can verify if t is a rotation of s by checking whether t is a substring of \(s+s\). That is, output "Yes" if \(t \subseteq s+s\), otherwise output "No".

inputFormat

The input consists of two lines. The first line contains the string s. The second line contains the string t.

outputFormat

Output a single line containing "Yes" if t can be obtained by rotating s any number of times; otherwise, output "No".

## sample
abcde
cdeab
Yes