标签:style c class blog code tar
反转一个字符串
垃圾方法:
#include <sstream> #include <vector> class Solution { public: void reverseWords(string &s) { istringstream is(s); string word; vector<string> dict; while (is >> word) { dict.push_back(word); } string ret = ""; for (int i = dict.size() - 1; i > 0; --i) { ret = ret + dict[i] + " "; } if (dict.size() > 0) ret += dict[0]; s = ret; } };
Evaluate Reverse Polish Notation
简单计算器
Reverse Words in a String,布布扣,bubuko.com
标签:style c class blog code tar
原文地址:http://www.cnblogs.com/fripside/p/3746640.html