View Code of Problem 114

#include <stdio.h>
#include <string.h>
int main()
{
	char a[100];
	gets(a);
	int j = 0;
	int m =0;
	int p;
	int n;
	int i;
	int temp;
	int q;
	n = strlen(a);
	for(i=0;i<n;i++)
	{     
		if((a[i]>= 'a'&&a[i]<='z')||(a[i]>= 'A'&&a[i]<='Z')) 
		m = m+1;
		if(a[i]== ' '||i==strlen(a)-1)
		{
			for(p = m-1,q=j;p>q;p--,q++)
			{
			 temp = a[p];
			 a[p] = a[q];
			 a[q] = temp;
			}
			j =i+1;
			m = j;
		}
	}
			puts(a);
	return 0;
 } 

Double click to view unformatted code.


Back to problem 114