LeetCode 394 Decode String - Problem Statement

The problem

Given an encoded string, return its decoded form.

The encoding rule is k[encoded_string], meaning the encoded_string is repeated k times.

With "3[a]2[bc]", the answer is "aaabcbc". 3[a] becomes "aaa", 2[bc] becomes "bcbc".

With "3[a2[c]]", the answer is "accaccacc". Inner 2[c] becomes "cc", so a2[c] is "acc", repeated 33 times.

Nested encodings are allowed. Brackets always match.

Constraints: 11 \le length 30\le 30. Numbers 11 to 300300.