题解 | #添加逗号#
添加逗号
https://www.nowcoder.com/practice/f51c317e745649c0900996fd3f683aed
#include <iostream> #include <string> using namespace std; int main() { string s,ret; cin>>s; int n = s.size(); int i = 0; while(i<n) { ret += s[i]; if(i!=n-1 && (n-i-1)%3==0) ret += ','; i++; } cout<<ret<<endl; return 0; } // 64 位输出请用 printf("%lld")