View Code of Problem 114

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

Double click to view unformatted code.


Back to problem 114