#include<bits/stdc++.h> using namespace std; int main() { string a, b; while(cin >> a) { int n = 3, k = 0; int len = a.size(); for(int i = len - 1; i >= 0; i--) { if(n == 0) { b[k++] = ','; n = 3; } if('0' <= a[i] && a[i] <= '9') { n--; b[k++] = a[i]; } } for(int j = k - 1; j >= 0; j--) cout << b[j]; cout << endl; } return 0; } |
Double click to view unformatted code.