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.
30:00
Java
Decode String
medium
Topics
Companies
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: "3[a]2[bc]"
Output: aaabcbc
Constraints:
1≤s.length≤30
s consists of lowercase English letters, digits, and [/].
s is a valid encoded string and the encoded count k satisfies 1≤k≤300.