added KMP algorithm