As we described the string matching problem, we said that we were interested in finding all valid shifts with which pattern P occurs in a given text T. If we translate that notion directly into an algorithm, we're able to arrive at the naive string matching algorithm.