Advertisement
Niloy007

FinalSampleProb1

Dec 14th, 2019
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class FirstProblemSolution {
  4.     public static void main(String[] args) {
  5.         Scanner input = new Scanner(System.in);
  6.         int n;
  7.         n = input.nextInt();
  8.         input.nextLine();
  9.         String text;
  10.         text = input.nextLine();
  11.         String sampleOne = text.substring(0, n);
  12.         String sampleTwo = text.substring(text.length() - n, text.length());
  13.  
  14.         if(sampleOne.equals(sampleTwo)) {
  15.             System.out.println("Yes");
  16.         } else {
  17.             System.out.println("No");
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement