Pages

Saturday, June 2, 2012

483 - Word Scramble




//
// main.cpp
// Word Scramble
//
// Created by Panks on 23/05/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#include <iostream>
using namespace std;
int main (int argc, const char * argv[])
{


string a, tmp;
char *input=new char[100000];
while(cin.getline(input, 100000)){
int i=0;
here:
tmp="";
while (input[i]!=' '&&input[i]!='\0') {
tmp=input[i]+tmp;
i++;
}
cout<<tmp;

if(input[i]!='\0'){
cout<<input[i];
i++;
goto here;
}else{
cout<<endl;
}


}
return 0;
}



No comments:

Post a Comment