Summary Power : What's wrong with my code?

I am getting an error as wrong answer but it’s working fine on ide
I request you to please help me in correcting my code… I am really thankful to you.
my_code: https://www.codechef.com/viewsolution/19050555
problem code: SUMPOWER

Hey,
Check this test case:

1

6 2

abcabc

Your Code Output: 2

Correct Output: 8

Yes, there was one mistake, but i have removed that bug. And still, its showing wrong answer but working fine on ide! please help…
updated code: https://www.codechef.com/viewsolution/19058787

Here is the updated code: https://www.codechef.com/viewsolution/19058787

I didn’t get into your code its very complicated to understand without a single comment or any hint what your program is doing but one thing is very clear that you are using 20 size array to read string which can be as long as 100000 characters.