2271 = Eddy problem (JAVA)

. 1  Import java.util.Scanner;
 2  public  class the Main {
 . 3      public  static  void main (String [] args) {
 . 4          Scanner INPUT = new new Scanner (the System.in);
 . 5          the while (input.hasNext ()) {
 . 6              String A = input.nextLine ();
 7              String b = input.nextLine ();
 8              / * 
9               * Some people may have questions about this, why should determine the length, a length that certainly does not include small, it is because this question can shift here I'm assuming two
 10               * string, a: AA, b: AAA , obviously not pro and strings, but our algorithm problems, leading to the determination that we will expand into AA AAAA, this judgment will lead to results error.
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 }

 

Guess you like

Origin www.cnblogs.com/Angfe/p/11735513.html