View Code of Problem 114

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
    string a;
    int k,t=0,p=0;
    while(getline(cin,a)){
        k=0;
        for(int i=0;i<a.length();i++){
            
            if(a[i]==' '){
                t=i;
                for(int j=t-1;j>=p;j--){
                    cout<<a[j];
                }
                cout<<" ";
                p=t+1;
//                break;
//                i=t;
            }
        }
    }
    
    return 0;
}

Double click to view unformatted code.


Back to problem 114