View Code of Problem 114

#include<stdio.h>
int main()
{
	char a[100];
	while (gets(a))
	{
		int i = 0, j,k, m, n;
		char t;
		while(a[i])
		{
			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