eolymp
bolt
Try our new interface for solving problems

Lines

Cyril boy once wrote to a paper line, consisting of large and small letters, and then went to play football. When he returned, he discovered that his friend Dima wrote under his string another line the same length. Dym argues that his line, he got a cyclic shift of the line of Cyril a few steps to the right (a cyclic shift of the line \textbf{abcde} at \textbf{2} positions to the right will give the line \textbf{deabc}). However, Dima known fact that might inadvertently be mistaken in a large number of calculations, so Cyril at a loss - whether to believe Dime? Help him! According to the data lines output the minimum possible size of the shift, or \textbf{-1} if Dima was wrong. \InputFile The first two lines of the input file contains rows of Cyril and Dima, respectively. The lengths of the strings are the same, do not exceed \textbf{10000}, and is not equal to \textbf{0}. \OutputFile The output file output a single number - the answer to our problem.
Time limit 2 seconds
Memory limit 64 MiB
Input example #1
abcde
deabc
Output example #1
2