View Code of Problem 114

#include <iostream>
#include <cstdio>
using namespace std;
int main(){
    string s;
    while(getline(cin,s)){
    int t=0;
    for(int i=0;i<s.length();i++){
        t=0;
        if(isalpha(s[i])){
            for(int j=i;j<s.length();j++){
                if(isalpha(s[j])){
                    t++;
                }
                else
                    break;
            }
            for(int j=i+t-1;j>=i;j--)
                cout<<s[j];
            i=i+t-1;
        }
        else
            cout<<s[i];
    }
        cout<<endl;}
    return 0;
}

Double click to view unformatted code.


Back to problem 114