Implemented second string matching algorithm.