Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- static boolean Including(String a,String b)
- {
- for(int i=0,Length=a.length();i<Length;i++)
- {
- int LengthB=b.length();
- if (a.charAt(i)==b.charAt(0))
- for (int k = i + 1, j = 1; j < LengthB; k++, j++)
- {
- if (a.charAt(k) != b.charAt(j)) break;
- if (j+1==LengthB) return true;
- }
- }
- return false;
- }
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- String a=in.nextLine();
- String b=in.nextLine();
- if (Including(a,b)) System.out.print("YES");
- else System.out.print("NO");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement