import java.io.*;
import java.lang.*;
class Polyndrome
{
public static void main(String args[]) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the String: ");
String s=br.readLine();
String temp=s;
StringBuffer sb= new StringBuffer(s);
sb.reverse();
s=sb.toString();
if(s.equals(temp))
System.out.print("String is polyndrome");
else
System.out.println("String is not polyndrome");
}
}
OUTPUT:
Compile: javac Polyndrome.java Run: java Polyndrome Enter the String: madam String is polyndrome Enter the String: Hello String is not polyndrome