View Code of Problem 114

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

Double click to view unformatted code.


Back to problem 114