StringBuilder.reverse方法

import java.util.*;

public class Main {

    private String reverse(String str) {
        StringBuilder res = new StringBuilder(str);
        return res.reverse().toString();
    }

    public Main() {
        Scanner in = new Scanner(System.in);
        while (in.hasNextLine()) {
            String str = in.nextLine();
            String res = reverse(str);
            System.out.println(res);
        }
   }

    public static void main(String[] args) 
    {
        Main solution = new Main();
    } 
}