句子逆序C++
句子逆序
http://www.nowcoder.com/questionTerminal/48b3cb4e3c694d9da5526e6255bb73c3
#include<iostream> #include<stack> #include<string> using namespace std; int main() { string str; stack<string> s; while(cin>>str) { s.push(str); } while(!s.empty()) { cout<<s.top(); s.pop(); if(!s.empty()) cout<<" "; } return 0; }