3
[
a
2
[
c
]
]
[0][1][2][3][4][5][6][7]
current string
3
[
a
2
[
c
]
]
[0][1][2][3][4][5][6][7]
Brute force · expand innermost repeatedly
▸1given s2while s contains "[":3 find the innermost k[body]4 replace it with body repeated k times5return s
state
- s"3[a2[c]]"