modified naive string search