Please help in java For all of the following words if you mo
Please help in java:
For all of the following words, if you move the first letter to the end of the word and then spell the word backwards , you get the original word:
banana dresser grammar potato revive uneven assess
Write a program that first asks the user how many words they will input, and then (after the user enters each word) determines whether it has this property. Treat uppercase and lowercase letters alike. That means that Banana also has this property.
Thank you
Solution
import java.util.Scanner;
public class reverseWord {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int r;
        Scanner scan = new Scanner(System.in);
        System.out.print(\"How many string will you enter? \");
        r = scan.nextInt();
        String s,rs,tmp;
        while(r>0)
        {
            System.out.print(\"Enter a string: \");
            s = scan.next();
            s = s.toLowerCase();
            tmp = s.substring(1,s.length())+s.charAt(0);
            rs = \"\";
            for(int i=tmp.length()-1;i>=0;i--)
            {
                rs = rs + tmp.charAt(i);
            }
            //System.out.println(rs);
            if(rs.equals(s))
            {
                System.out.println(\"The string has the property\");
            }
            else
            {
                System.out.println(\"The string does not have the property\");
            }
            r--;
           
        }
    }
}

