Paintzen Interview Question

Algorithm problem involving string matching