View Code of Problem 114

#include<bits/stdc++.h>
using namespace std;


int main() {
	string a;
	while (getline(cin, a)) {
		for (int i = 0; i < a.size(); i++) {
			if (isalpha(a[i])) {
				int l=i;
					while (isalpha(a[i + 1])) {
						i++;
				}
					for (int j = i; j >= l; j--) {
						cout << a[j];
					}
			}
			else {
				cout << a[i];
			}
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 114