J.P. Morgan interview question

Basic and intermediate string manipulation