Naive String Matcher

The naive string matching algorithm finds a pattern in a text. It uses brute force to check every position. It works by moving the pattern across the text from left to right. At each position, the algorithm compares the pattern’s characters to the text’s characters. If every character matches, the position is valid. Its takes O((n - m + 1) m) time.