View Code of Problem 114

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

Double click to view unformatted code.


Back to problem 114