View Code of Problem 114

#include <stdio.h>
#include <string.h>
 
int main()
{
    int i,j,k;
    char a[1000];
    while(gets(a) != NULL)
    {
        int l=strlen(a);
        for(i=0;i<l;i++)
        {
            k=0;
            if(a[i]>='a' && a[i]<='z' || a[i]>='A' && a[i]<='Z')
            {
                for(j=i;j<l;j++)
                {
                    if(a[j]>='a' && a[j]<='z' || a[j]>='A' && a[j]<='Z')
                    {
                        k++;
                    }else
                    {
                        break;
                    }
                }
                int t;
                for(t=i+k-1;t>=i;t--)
                {
                    printf("%c",a[t]);
                }
                i=i+k-1;
            }else
            {
                printf("%c",a[i]);
            }
        }
        printf("\n");
    }
	return 0;
}

Double click to view unformatted code.


Back to problem 114