View Code of Problem 114

#include<stdio.h>
int main()
{
	char a[100];
	while (gets(a)!=NULL)
	{
		int i = 0,j,k,m,n;
		char t;
		while(a[i]!=NULL)
		{
			while ((a[i] >= 'a'&&a[i] <= 'z' || a[i] >= 'A'&&a[i] <= 'Z')==0)
				i++;
			    m =i;//直到字母 
			while (a[i] >= 'a'&&a[i] <= 'z' || a[i] >= 'A'&&a[i] <= 'Z')
				i++;
			   n=i-1;//直到最后一个字母 
			for (k=0,j=m;j<=(m + n)/2;j++)
			{
				t = a[j];
				a[j]=a[n-k];
				a[n-k]=t;
				k++;
			}
		}
		puts(a);
	}
}

Double click to view unformatted code.


Back to problem 114