View Code of Problem 114

#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
	char a[1000];
	while(gets(a)){
		int i=0,j=0,k=0;
		while(i<strlen(a)){
			while(a[i]!=' '&&i<strlen(a))
			 ++i;
			 j=i-1;
			 ++i;
			 for(;j>=k;--j)
			 cout<<a[j];
			 k=i;
			 if(i>=strlen(a))
			 cout<<endl;
			 else
			 cout<<' ';
		}
	}

	return 0;
} 

Double click to view unformatted code.


Back to problem 114