implemented linear time method to search for substring occurrences in the ascii string