题解 | #动态字符串#
动态字符串
http://www.nowcoder.com/practice/e2c51a6f126b41f9be403376c7adea15
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String str = scanner.next();
int i;
//使用可变字符串StringBuilder,参数为静态的字符串str
StringBuilder str_test=new StringBuilder(str);
for(i=str.length()-3;i>=0;i-=3){
//插入","
str_test.insert(i,",");
}
System.out.println(str_test);
//write your code here......
}
}