import java.io.IOException;
import java.util.Scanner;
public class DelKong {
public static void main(String[] args) throws IOException {
System.out.println("请输入字符串:");
Scanner sc = new Scanner(System.in);
//trim()去掉首尾空格
String str=sc.nextLine().trim();
String result=str.replace(" ","");
//1,第一种方法
for(int i=result.length()-1;i>=0;i--){
char ch=result.charAt(i);
System.out.print(ch);
}
System.out.println("------");
//2,第二种方法
char[] chs = result.toCharArray();
for(int i=result.length()-1;i>=0;i--){
System.out.print(chs[i]);
}
System.out.println("------");
//3,第三种方法
StringBuffer sb = new StringBuffer(" he ll o w or ld!");
sb.reverse();//字符串倒序
String s = sb.toString();
String res = s.trim();
String res_s = res.replace(" ","");
System.out.print(res_s);
}
}