Decode String Recursively

An encoded string is given. The pattern in which the strings are encoded is as follows: <count>[sub_str] means that the substring 'sub_str' appears count times. The task is to decode the given string.

Examples:

"1[b]"should return "b".

"2[ab]" should return "abab".

"2[a2[b]]"should return "abbabb".

Contributed by Berkan Teber