Nielsen interview question

Algorithm involving strings and how to work with it