View Code of Problem 114

#include<stdio.h>
int main()
{
	int a,b,i,t;
	char str[1000],c;
	while(gets(str)!=NULL)
	{
		t=0;
		while(str[t])
		{
			if(str[t]==' ')
				t++;
				for (i=t;(str[i]>='a'&&str[i]<='z')||(str[i]>='A'&&str[i]<='Z');i++);
					if(i!=t)
					{
						a=t,b=i-1;
						if(a!=b)
						{
						for(i=0;i<(b-a+1)/2;i++)
						{
							c=str[a+i];
							str[a+i]=str[b-i];
							str[b-i]=c;
						}
						}
						t=b+1;
					}
					else
						t++;
		}
		puts(str);
	}
}




Double click to view unformatted code.


Back to problem 114