Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Palindrom
- {
- public static void main(String[] args)
- {
- Scanner in = new Scanner(System.in);
- String word = in.next().toLowerCase();
- String word2 = "";
- for (int i = word.length() -1; i>=0; i--) {
- word2 += word.charAt(i);
- }
- if (word2.equals(word))
- {
- System.out.println(word + " is a palindrome");
- }
- else{
- System.out.println(word + " is not a palindrome");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement