7329: Cyclic Shifts(Problem J4)

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:4 解决:3

题目描述

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. For 6 of the 15 available marks, S will be exactly 3 characters in length.

输出

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

样例输入 复制

ABCCDEABAA
ABCDE

样例输出 复制

yes

提示

CDEAB is a cyclic shift of ABCDE and it is contained in the text ABCCDEABAA.

来源/分类