import java.io.*;
class ReverseString
{
public static void main(String args[]) throws IOException
{
String str;
System.out.println("Enter a string");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
str=br.readLine();
StringBuffer sb=new StringBuffer(str);
String revstr=new String(sb.reverse());
System.out.println("Reverse of "+str+" is "+revstr);
}
}
No comments:
Post a Comment