leetcode394

class Solution {
public:
string decodeString(string s) {
stack<string> chars;
stack<int> nums;
string res;
int num = ; for (char c: s) {
if (isdigit(c))
num = num * + (c - '');
else if (isalpha(c)) {
res += c;
} else if (c == '[') {
chars.push(res);
nums.push(num);
res = "";
num = ;
} else {
string tmp = res;
for (int i = ; i < nums.top() - ; i++)
res += tmp;
res = chars.top() + res;
chars.pop();
nums.pop();
}
} return res;
}
};
上一篇:带你读《实分析(原书第4版)》之四:Lebesgue可测函数


下一篇:ionic项目ios真机部署(不需开发者账号)