题解 | #添加逗号#
添加逗号
http://www.nowcoder.com/practice/f51c317e745649c0900996fd3f683aed
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String str = scanner.next(); StringBuilder stringBuilder = new StringBuilder(str); for(int index = str.length() - 3; index > 0; index -= 3){ stringBuilder.insert(index, ','); } System.out.print(stringBuilder.toString()); } }