View Code of Problem 114

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

Double click to view unformatted code.


Back to problem 114