What is wrong in my solution?

Question link- Problem - C - Codeforces
My submission- Submission #63779434 - Codeforces

Can anyone tell where I am doing wrong.

K is like length of the substring least length for the substring , right?