DIY: Decoding a String

Solve the interview question " Decoding a String" in this lesson.

Problem statement

Given an encoded string, return its decoded string.

The input string is encoded such that k[pattern] should be decoded to pattern repeatedly for k times. ...