View Code of Problem 114

#include<bits/stdc++.h>

using namespace std;

int main(){
    string str;
    char a[200] = {0};
    while(getline(cin,str)){
        int t = 0;
        for(int i = 0 ; i < str.size(); i++){
            if(isalpha(str[i])){
                    int j = i;
                while (isalpha(str[j]))
                       j++;
            for(int k = j - 1 ; k >= i; k--){
                a[t++] = str[k];
            }
            i = j-1;
        }
         else a[t++] = str[i];

        }
        for(int i = 0; i < t; i++){
            cout << a[i];
        }
        cout << endl;
    }

}

Double click to view unformatted code.


Back to problem 114