UVa 483-Word Scramble



#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
using namespace std;
 
int main() {
    string s;
    bool first;
    while(getline(cin, s)){
        istringstream is(s);
        first = true;
        while(is>>s){
                reverse(s.begin(), s.end());
                if(!first) cout<<" ";
                cout<<s;
                first = false;
        }
        cout<<endl;
    }
        return 0;
}
Runtime: 0.015
Ideone : http://ideone.com/Htva0d

Comments

Popular Posts