#t190. 字符串移位包含问题

字符串移位包含问题

Cyclic-Shift Substring

Problem Description

For a string, one cyclic shift is defined as moving its first character to the end to form a new string.

Given two strings s1s_1 and s2s_2, determine whether one of them is a substring of the other string after several cyclic shifts. For example, CDAA is a substring of BCDAA, which is obtained from AABCD by two shifts; whereas ABCD and ACBD cannot yield, by any number of shifts, a new string of which one is a substring.

Input Format

One line containing two strings separated by a single space. The strings contain only letters and digits, and have length at most 3030.

Output Format

If one string is a substring of the other's shifted string, output true; otherwise output false.

Sample Input

AABCD CDAA

Sample Output

true