题解 | #句子逆序#

句子逆序

https://www.nowcoder.com/practice/48b3cb4e3c694d9da5526e6255bb73c3

#include <cstdlib>
#include <iostream>
#include<sstream>
#include <stack>
using namespace std;

int main() {
    string s;
    getline(cin,s);
    string word;
    stack<string> stk;
    istringstream iss(s);
    while(getline(iss,word,' '))stk.push(word);
    while(stk.size() != 1){
        cout << stk.top() << ' ';
        stk.pop();
    }
    cout << stk.top()<<endl;
    stk.pop();
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

01-29 16:08
已编辑
华南农业大学 Java
点赞 评论 收藏
分享
01-14 12:08
门头沟学院 Java
神哥了不得:(非引流)1.既然发出来了简历,就稍微提一点点小建议,确实简历很不错了,练手项目可以换一些质量高的,工作内容,可以加上一些量化指标,比如第一条系统响应速度由多少变成多少,减少了百分之多少,第4条就很不错。2.广投,年前实习招募比较少了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务