题解 | #数字颠倒#
数字颠倒
https://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe
思路比较简单,做了这几条,就这一条能一眼看出来的。直接当作String倒序就行:
import java.io.IOException; import java.io.InputStream; import java.io.BufferedReader; import java.util.*; public class Main { public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(System.in); String s = scanner.nextLine(); char[] chars = s.toCharArray(); for (int i = chars.length-1; i >=0 ; i--) { System.out.print(chars[i]); } System.out.println(); } }