PopCap Games interview question

Fancy algorithm and string questions