1 import java.util.Scanner;
2 public class Main {
3 public static void main(String[] args) {
4 Scanner input = new Scanner(System.in);
5 while(input.hasNext()) {
6 String a = input.nextLine();
7 String b = input.nextLine();
8 /*
9 * 可能有人对这里有疑问,为什么要判断长度,a的长度小 那肯定不包含,那是因为本题可以移位,在这里我假设两
10 * 个字符串,a:AA,b:AAA,很明显不是亲和串,但是我 们的算法问题,导致在判断是我们会将AA扩展成AAAA,这 样判断会导致结果错误。
11 */
12 if(a.length()<b.length()) {
13 System.out.println("no");
14 }
15 else {
16 a=a+a;
17 if(a.indexOf(b)!=-1)System.out.println("yes");
18 else System.out.println("no");
19 }
20 }
21 }
22 }