Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Palindrom
  4. {
  5. public static void main(String[] args)
  6. {
  7. Scanner in = new Scanner(System.in);
  8. String word = in.next().toLowerCase();
  9. String word2 = "";
  10.  
  11. for (int i = word.length() -1; i>=0; i--) {
  12. word2 += word.charAt(i);
  13. }
  14. if (word2.equals(word))
  15. {
  16. System.out.println(word + " is a palindrome");
  17. }
  18. else{
  19. System.out.println(word + " is not a palindrome");
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement