Google Interview Question

String manipulation, dynamic programming, basic data structure