import java.util.*; import java.io.*; public class Main{ public static void main(String[] args) throws Exception{ //Scanner sc=new Scanner(System.in); BufferedReader sc=new BufferedReader(new InputStreamReader(System.in)); String line = sc.readLine(); StringBuilder sb=new StringBuilder(line); sb.reverse(); System.out.println(sb); } }将Scanner替换为BufferedReader,速度快了不少