View Code of Problem 114

#include<bits/stdc++.h>
using namespace std;
int main(){
	char tmp[1000],c[1000];
	while(gets(c)){
		int len = strlen(c),flag = 0;
		for(int i = 0;i<len;i++){
			if(c[i]>='a' && c[i]<='z' ||c[i]>='A' && c[i]<='Z'){
				flag = 0;	
				while(c[i]>='a' && c[i]<='z' ||c[i]>='A' && c[i]<='Z') tmp[flag++] = c[i++];
				i--;
				for(int t = flag - 1;t>=0;t--)cout<<tmp[t];
			}
			else cout<<c[i];	
		}
		cout<<endl;	
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 114