Олимпиадный тренинг

Задача 33308. Stitches


The boy Kirill once wrote a line on a sheet of paper, consisting of large and small Latin letters, and after that he went to play football. When he returned, he found that his friend Dima had written another line of the same length under his line. Dima claims that he got his line by cyclically shifting Kirill's line a few steps to the right (cyclically shifting the line abcde by 2 positions to the right will give the line deabc).
However, Dima is known for the fact that he can accidentally make mistakes in a large number of calculations, so Kirill is at a loss – whether to believe Dima? Help him! Based on the given lines, print the minimum possible shift size or -1 if Dima made a mistake.
 
Input
The first two lines of the input contain the lines of Kirill and Dima, respectively. The lengths of the strings are the same, do not exceed 10000 and are not equal to 0.
 
Output
Print a single number – answer  to the question of the problem.
 

 

Examples
# Input Output
1
zabcd
abcdz
4