给过了,但是最后输出的时候,最后一个后面应该没有空格?但是牛客网给过了,emm
#include<iostream>
#include<stack> //还是用字符串栈了!
using namespace std;
int main()
{
string str;
stack<string> s;
while(cin>>str) //cin遇到空格则停止
{
s.push(str);
}
while(!s.empty())
{
cout<<s.top()<<' ';
s.pop();
}
return 0;
}


京公网安备 11010502036488号