Advertisement
SergeyPGUTI

7.2.9

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