题解 | #字符逆序#
字符逆序
http://www.nowcoder.com/practice/cc57022cb4194697ac30bcb566aeb47b
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
if(sc.hasNext()){
String str = sc.nextLine();
//遍历字符串,从最后一个字符开始
String result="";
String getStr="";
for(int i=str.length();i>0;i--){
//获得第i个字符串
getStr=str.substring(i-1,i);
result +=getStr;
}
System.out.print(result);
}
}
}