View Code of Problem 101

#include<iostream>
#include<string>
#include<vector> 
using namespace std;
int main(){
	string str;
	while(cin>>str){ 
		vector<char> v;
		for(int i=0;i<str.size();i++){
			if(str[i]>='0'&&str[i]<='9'){
				v.push_back(str[i]);
			}
		}
		for(int i=0;i<v.size();i++){
			if((v.size()-i)%3 == 0 && i!=0){	cout<<","; }
			cout<<v[i];
		}
		cout<<endl;
	} 
	
} 

Double click to view unformatted code.


Back to problem 101