 All Problems
Decode String
medium
stack
string
recursion
amazon
google
facebook
microsoft

Given an encoded string, return its decoded string.

The encoding rule is: k[encoded_string], where the encoded_string inside the brackets is repeated exactly k times.

Example 1:

Input: 3[a]2[bc]
Output: aaabcbc

Example 2:

Input: 3[a2[c]]
Output: accaccacc

Input format: Single encoded string.

Output format: Decoded string.

Run to check your code against the sample cases, or submit to run every case