View Code of Problem 101

#include<stdio.h>
#include<string.h>
int main()
{
char s[100],c[100];
int i,j=0,k=0;
while(gets(s)!=NULL)
{
for(i=strlen(s)-1;i>=0;i--)
{
if(s[i]!=',')
{
if(k==3)
{
c[j++]=',';
k=0;
}
c[j++]=s[i];
k++;
}
}
j--;
for(i=0;j>=0;j--,i++)
s[i]=c[j];
printf("%s\n",s);
k=0;j=0;
for(i=0;i<100;i++)
c[i]=s[i]=NULL;

}
}

Double click to view unformatted code.


Back to problem 101