View Code of Problem 114

#include <stdio.h>
#include <stdlib.h>
#include<ctype.h>
#include<string.h>
#include<math.h>
void nizhi(char a[], int l, int r)
{
	int i, j, temp;
	for (i = l, j = r; i < j; i++, j--)
	{
		temp = a[i];
		a[i] = a[j];
		a[j] = temp;
	}
}
int main()
{
	int i, j, n;
	char a[100];
	while (gets(a)!=NULL)
	{
		i = 0; j = 0;
		while (i<strlen(a))
		{
			while (isalpha(a[j]))
			{
				j++;
			}
			nizhi(a, i, j-1);
			i = j+1;
			j++;
		}
		puts(a);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 114