Prefix function in KMP algorithm

What is the significance of finding the prefix function in Knuth Morris Pratt algorithm? And where else can I use the prefix function?

Terima kasih dan salam kenal.
codechef Link

code Link