View Code of Problem 114

#include<stdio.h>
int main()
{
	char a[10000]; 
	while(gets(a))
	{	
		for(int i=0;i<strlen(a);i++)//从前往后 
		{	int flag;
			if((a[i]>='a'&&a[i]<='z')||(a[i]>='A'&&a[i]<='Z'))
			{
				flag=i;
				while((a[i+1]>='a'&&a[i+1]<='z')||(a[i+1]>='A'&&a[i+1]<='Z'))
				{
					i++; 
				}
				for(int j=i;j>=flag;j--)
				{
					printf("%c",a[j]);
				}
				
			}
			else
			{
				printf("%c",a[i]);
			}
		}
		printf("\n");  
	}
	return 0; 
}

Double click to view unformatted code.


Back to problem 114