#include #include using namespace std; void reverse(char* sentence) { int index = strlen(sentence) - 1; char last = \'\\0\';
You can do it by istringstream class of C++
#include using namespace std; int main() { string s,st,w; int i; getline(cin,s); istringstream is(s); st=""; is>>st; while(is>>w) { st=w+' '+st; } cout<