Google Interview Question

String manipulation and dynamic programming