Naive Algorithm String Matching Python Code