~/algor $ cat problems/string-siklik-surilganmi
Cyclic shift?
Medium
1000 ms
128 MB
59%
Two words $s$ and $t$ of the same length are given. Determine whether $t$ can be obtained by a cyclic shift of $s$ — taking several (possibly zero) letters from the beginning and moving them to the end.
Input
The first line contains $s$, the second line $t$.
Output
YES if it is possible, otherwise NO.
Note
$1 \le |s| = |t| \le 5 * 10^{4}$
$s$ and $t$ consist of lowercase Latin letters only
Examples
Input #1
algor goral
Output #1
YES
Input #2
abc acb
Output #2
NO