Amazon interview question

String manipulation and String decode