思路
模拟
过程
代码
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
string str, ans;
cin >> str;
int n = str.size();
for(int i = 0;i < n;i ++)
{
ans += str[i];
if((n - i - 1) % 3 == 0 && i != n - 1) ans += ',';
}
cout << ans << endl;
return 0;
}