JAVA朴素解法-两种类型
字符串反转
http://www.nowcoder.com/questionTerminal/e45e078701ab4e4cb49393ae30f1bb04
import java.util.*; public class Main{ public static void main(String[] args){ Scanner in=new Scanner(System.in); String a=in.next(); System.out.println(getString(a)); } public static String getString(String a){ char[] chararr = a.toCharArray(); for(int i=0;i<chararr.length/2;i++){ char tmp=chararr[i]; chararr[i]=chararr[chararr.length-1-i]; chararr[chararr.length-1-i]=tmp; } return new String(chararr); } public static String getString1(String a){ return new StringBuilder(a).reverse().toString()); } }