#include<stdio.h> #include <string.h> #include <math.h> int main(){ char a[1000]; int i,j=0,k=0; while(gets(a)){ char b[1000]; int n=strlen(a); for(i=n-1;i>=0;i--){ if(a[i]!=','){ if(k==3){ b[j++]=','; k=0; } b[j++]=a[i]; k++; } } b[j]='\0'; for(i=strlen(b)-1;i>=0;i--){ printf("%c",b[i]); } printf("\n"); j=0; k=0; } printf("\n"); return 0; } |
Double click to view unformatted code.