Decode an encoded string | Instacart Interview Question