Given a string of size , we define the -th rotation of (for ) as
Given two strings and , compute how many -th rotations of are equal to .
For instance, for
“abbabb” and
“babbab” the answer is 2, corresponding to
and
.
Input consists of several cases, each one with two strings and with only lowercase letters. Assume . Every letter appears the same number of times in and in .
For every case, print the number of -th rotations of that are equal to .
Author: Salvador Roura
Generation: 2026-01-25T11:11:45.976Z
© Jutge.org, 2006–2026.
https://jutge.org