Answers

2016-04-22T15:31:35+05:30
Import java. io.*;
class Sample
{
public static void main(String args[])throws IOException
{
String word,rev;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the word which is to be checked whether it is a palindrome word or special word.\n"):
word=br.readLine();
int len=word.length();
char ch1=word.charAt(0);
char ch2=word.charAt(len-1);
StringBuffer obj=new StringBuffer(word);
obj=obj.reverse();
rev=obj.toString();
if(word.equals(rev))
{
System.out.print("It is a pallindrome word.");
}
else if(ch1=ch2)
{
System.out.print("It is a special word.");
}
else
{
System.out print("It is neither a pallindrome word, nor a special word.");
}
}
}

0