View Code of Problem 114

#include <iostream>
#include <string>
using namespace std;

string turn(string str);

int main() {
	string a;
	while(getline(cin,a)) {
		
		string str;
		for(int j=0; j<a.length(); j++) {
			if((a[j]>='a'&&a[j]<='z')||(a[j]>='A'&&a[j]<='Z')){
				str=a[j]+str;
			}
			else{
				cout << str << a[j];
    			str.clear();
			}
		}
		cout << str<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 114