Added prefix function definition for KMP