[LeetCode]Reverse Words in a String
来源:互联网 发布:知乎 女生减肥 编辑:程序博客网 时间:2024/06/06 19:57
class Solution {public: void reverseWords(string &s) { string word; stack<string> wordsStack; stringstream ss(s); while(ss>>word) { wordsStack.push(word); } string res = ""; bool first = true; while(!wordsStack.empty()) { if(!first) res += " "; res += wordsStack.top(); wordsStack.pop(); first = false; } s = res; }};
0 0
- Leetcode - string - Reverse Words in a String
- Reverse words in a String leetcode
- [LeetCode]Reverse Words in a String
- 【LeetCode】Reverse Words in a String
- Reverse Words in a String (LeetCode)
- LeetCode Reverse Words in a String Total
- LeetCode(151)Reverse Words in a String
- Reverse Words in a String -- LeetCode
- leetcode Reverse Words in a String
- LeetCode OJ:Reverse Words in a String
- LeetCode Reverse Words in a String
- 【LeetCode】Reverse Words in a String
- [Leetcode] Reverse Words in a String
- Reverse Words in a String[LeetCode]
- LeetCode OJ :Reverse Words in a String
- Leetcode: Reverse Words in a String
- 【LeetCode】Reverse Words in a String
- 【LeetCode】Reverse Words in a String
- WebService入门课程(01)
- Directx 纹理贴图 模仿地面效果
- vim中命令学习技巧——快捷键
- 利用 UDF 轻松迁移
- 第6周作业3-Fibonacci数列
- [LeetCode]Reverse Words in a String
- DOSBox 挂载目录 Unable to change to..
- iOS多线程编程之Grand Central Dispatch(GCD)介绍和使用
- read 系统调用剖析
- java date时间 辅助常用方法
- python学习(程序打包的方法)
- 插卡开机后弹出消费提示语,用PopupWindow实现
- 关于C语言使用输入函数后键盘缓冲区还有多余字符没的问题
- 知识