[LeetCode C++实现]394. Decode String
递归实现:
class Solution {
public:
string decodeString(string s) {
int i = 0;
return decodeString(s,i);
}
private:
string decodeString(string s,int &i) {
string res;
while(i < s.size() && s[i]!=']')
{
if(!isdigit(s[i]))
res += s[i++];
else
{
int n = 0;
//获取数字
while(i < s.size() &......