View Code of Problem 101

#include<iostream>

using namespace std;

int main(){
	string s;

	while(getline(cin,s)){
		char c[100];
		int count=1;
		for(int i=0;i<s.length();++i){
			if(s[i]!=','){
				c[count++]=s[i];
			}
		}
		for(int i=1;i<count;++i){
			cout<<c[i];
			if(i%3==(count-1)%3 && i!=count-1){
				cout<<',';
			}
		}
		cout<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 101