Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times.
Example 1
Input: s = 3[a]2[bc]
Output: aaabcbc
Explanation: 3[a] expands to "aaa" and 2[bc] expands to "bcbc". Joined together they give "aaabcbc".
Example 2
Input: s = 3[a2[c]]
Output: accaccacc
Explanation: Decode from the inside out: 2[c] becomes "cc", so a2[c] is "acc". Repeating that 3 times gives "accaccacc".
Example 3
Input: s = 2[abc]3[cd]ef
Output: abcabccdcdcdef
Explanation: 2[abc] becomes "abcabc" and 3[cd] becomes "cdcdcd". The trailing "ef" is copied as-is, giving "abcabccdcdcdef".
`[...]` segments can nest. When we hit `[`, we freeze the current state (the string built so far and the multiplier) on a stack, and start a fresh inner build. When we hit `]`, we pop and splice the inner `k` times into the parent.
Run checks all cases above. Submit evaluates all test cases.