Cyclic Shifts | 프로그래밍의 벗 PivotOJ
PivotOJ

Cyclic Shifts

시간 제한: 2000ms메모리 제한: 512MB출처: CCC 2020 JuniorBOJ 19605

문제

Thuc likes finding cyclic shifts of strings. A cyclic shift of a string is obtained by moving characters from the beginning of the string to the end of the string. We also consider a string to be a cyclic shift of itself. For example, the cyclic shifts of ABCDE are:

ABCDE, BCDEA, CDEAB, DEABC, and EABCD.

Given some text, T, and a string, S, determine if T contains a cyclic shift of S.

입력

The input will consist of exactly two lines containing only uppercase letters. The first line will be the text T, and the second line will be the string S. Each line will contain at most 1000 characters.

출력

Output yes if the text, T, contains a cyclic shift of the string, S. Otherwise, output no.

예제

예제 1

입력
ABCCDEABAA
ABCDE
출력
yes

예제 2

입력
ABCDDEBCAB
ABA
출력
no
코드를 제출하려면 로그인하세요.