View Code of Problem 114

#include<iostream>
#include<string>
using namespace std;
int main() {
	string str;
	while (getline(cin, str)) {
		string s;
		for (int i = 0; i < str.size(); i++) {
			if (isalpha(str[i]))
				s = str[i] + s;
			else {
				cout << s << str[i];
				s.clear();
			}
		}
		cout << s << endl;
	}
}

Double click to view unformatted code.


Back to problem 114