题解 | #动态字符串#
import java.util.Scanner; //运用学到的StringBuffer中的insert方法,并利用一个循环确定插入位置,最后得到所需结果 public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String str = scanner.next();
//write your code here......
StringBuffer sb = new StringBuffer(str);
int l = str.length();
while(l > 0){
l -= 3;
if(l < 0) break ;
sb.insert(l , ',');
}
System.out.print(sb);
}
}