A solution to the nested strings problem, posed by Codility.