View Code of Problem 114

#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	char a[1000];
	while(gets(a)!=NULL){
	int k=0,l=0;
	for(int i=0;i<strlen(a);i++){
		
		if((a[i]>='a'&&a[i]<='z')||(a[i]>='A'&&a[i]<='Z'))k++;
		else {
			for(int j=i-1;j>=l;j--)
			printf("%c",a[j]);
			k=0;l=i+1;
			printf(" ");
		}
		if(i==strlen(a)-1&&a[i]!=' ')for(int q=i;q>=l;q--)
			printf("%c",a[q]);
	}
	}
}	

Double click to view unformatted code.


Back to problem 114