Sunday string matching algorithm