JZ44 翻转单词序列 本文最后更新于:2022年4月9日 中午 Solution 12345678910111213141516class Solution {public: string ReverseSentence(string str) { string res = "", cur = ""; for (char c : str) { if (c == ' ') { res = " " + cur + res; cur = ""; } else { cur += c; } } if (!cur.empty()) res = cur + res; return res; }}; algo 字符串 nowcoder 本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处! JZ45 扑克牌顺子 上一篇 JZ43 左旋转字符串 下一篇 Please enable JavaScript to view the comments powered by Valine.