Getting same output for other possible inputs also

https://ide.codingblocks.com/s/653737 : This code is giving the same output for different inputs also. I do not know what possible thing I can do to correct this. Please check this code and do the required modifications.

hi @sb1251224_6919c19fccd96630
ur code works fine only with small letters. what if string contains contains capital letters or any special character, ur code fails there…
so what u can do is simply maintain a map of char and frequency of that character, and hence compute the final ans…
corrected code -->


It’s passing all test cases now…

@sb1251224_6919c19fccd96630
is it clear now??

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

But I haven’t learn mapping till now, is there any other way to do this?

hi @sb1251224_6919c19fccd96630
u can do it like this