字符串的单词颠倒 题解:
P5271
发布于2026年3月29日 14:25
阅读数 247
#include<iostream>
#include<stack>
using namespace std;
string str;
stack<string> st;
int main()
{
int n;
cin>>n;
while(cin>>str)
st.push(str);
while(!st.empty())
{
cout<<st.top()<<" ";
st.pop();
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发