Google interview question

String manipulation, dynamic programming, basic data structure