J.P. Morgan Interview Question

String manipulations and sorting with arrays