题解 | #字符串反转#
字符串反转
https://www.nowcoder.com/practice/e45e078701ab4e4cb49393ae30f1bb04
import java.io.*; public class Main { public static void main(String[] args) throws IOException { //对于大量用户输入或需要更高效读取输入的情况,可以考虑使用BufferedReader而不是Scanner //因为BufferedReader通常更高效。 BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); System.out.print(new StringBuilder(str).reverse()); } }