Skip to content

Commit 90e9547

Browse files
authored
Update decode-string.py
1 parent 031338f commit 90e9547

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Python/decode-string.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ def decodeString(self, s):
1111
for c in s:
1212
if c.isdigit():
1313
n = n*10 + ord(c)-ord('0')
14+
elif c.isalpha():
15+
curr.append(c)
1416
elif c == '[':
1517
nums.append(n)
1618
strs.append(curr)
1719
n, curr = 0, []
1820
elif c == ']':
1921
strs[-1].extend(curr*nums.pop())
2022
curr = strs.pop()
21-
else:
22-
curr.append(c)
2323
return "".join(curr)
24-

0 commit comments

Comments
 (0)