题解 | #单词倒排#

单词倒排

http://www.nowcoder.com/practice/81544a4989df4109b33c2d65037c5836

#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    while(getline(cin,s)){
        string ans;
        for(int i=s.length() - 1;i>=0;i--){
            string tmp;
            while(isalpha(s[i])&&i>=0){
                tmp=s[i]+tmp;
                i--;
            }
            ans +=(tmp+" ");
        }
        ans=ans.substr(0,ans.length()-1);
        cout<<ans<<endl;
    }
    
}
全部评论

相关推荐

03-29 19:11
门头沟学院 Java
wyp_davis:是可以这样的,不过只要交钱就是假的
点赞 评论 收藏
分享
挣K存W养DOG:我记得好多人说这个公司就是白嫖方案的,现在有大体方案要让你给他展示实现细节了,也是无敌了
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务