View Code of Problem 101

#include<string.h>
#include<stdio.h>
int main(){
	char a[100];
	char b[100];
	int i;
	int j=0;
	while(scanf("%s",a)!=EOF){
		
		for(i=strlen(a)-1;i>=0;i--){
			if(a[i]!=','){
				b[j++]=a[i];
				if(j%3==0&&i!=0){
					b[j++]=',';
				}
			}
			
		}
	}
	for(i=j-1;i>=0;i--){
		printf("%c",b[i]);
	}

}

Double click to view unformatted code.


Back to problem 101