Partially correct answer

I don’t know why my code for the problem https://www.codechef.com/IARCSJUD/problems/LOPreformatted textNGPALI
is giving partially correct answer .Please help me .My code : 6CxroI - Online Python3 Interpreter & Debugging Tool - Ideone.com.
Thanks in advance.

5000
aaaaa… aa [5000 times]

Your are doing a BF ! Optimize …

Can you help me for this?

Might help : here

thanks for help