Please help me in LCH15JAB (Beginner level)

can someone find error in my code?

problem: LCH15JAB Problem - CodeChef

my code: CodeChef: Practical coding for everyone

This may be the possible reason:

int alphabets[26];

You’ve used this array to store the frequency of alphabets, but you haven’t initialized it to 0 (zero). There is no guarantee that it’ll be initialized to 0 (zero) by default. Rather, it may contain garbage values.

So, initialize it to 0 (zero) and your code should get accepted.

You may use the following statement to do it.

memset(alphabets, 0, sizeof(alphabets));

thx a lot,really helped me

btw, could have done just, int alphabets[26]={0};