View Code of Problem 114

#include<stdio.h>
#include<string.h>
int main()
{
	char a[1000],temp;
	
	int i,m,n,j,k;
	//len=strlen(a);
	while(gets(a)!=NULL)
    {    
		for(i=0;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++)
		{
			temp=a[j];
			a[j]=a[n-k];
			a[n-k]=temp;
			k++;
		}
		
	}
	puts(a);
}
	
 }

Double click to view unformatted code.


Back to problem 114