J.P. Morgan interview question

String manipulations and sorting with arrays