Compressing a string

Can someone explain Compressing a string from Prefix function - Knuth-Morris-Pratt - Algorithms for Competitive Programming with some diagram?
I am not clear about a solution.

  1. Why the final answer will be k not smaller.
  2. Cases
  3. In the last case how all strings will be equal?