Advertisement
SergeyPGUTI

7.2.11

Nov 26th, 2015
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Main {
  3.  
  4.  
  5.     static boolean  Including(String a,String b)
  6.     {
  7.         for(int i=0,Length=a.length();i<Length;i++)
  8.         {
  9.             int LengthB=b.length();
  10.             if (a.charAt(i)==b.charAt(0))
  11.  
  12.                 for (int k = i + 1, j = 1; j < LengthB; k++, j++)
  13.                 {
  14.                     if (a.charAt(k) != b.charAt(j)) break;
  15.                     if (j+1==LengthB) return true;
  16.                 }
  17.  
  18.         }
  19.         return false;
  20.     }
  21.  
  22.     public static void main(String[] args) {
  23.         Scanner in = new Scanner(System.in);
  24.         String a=in.nextLine();
  25.         String b=in.nextLine();
  26.         if (Including(a,b)) System.out.print("YES");
  27.             else System.out.print("NO");
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement