How are negative numbers relevant to this program?

“your program didn’t account for all input cases (did you account for negative numbers, for example?).” This is the msg i receive for this code: https://ide.codingblocks.com/s/247217

hi @wtakashish that is a generalised message for when you get a WA, there can be other logical errors inn your code as well. I am having a look at it, please wait.

hi @wtakashish can you explain what you are trying to do in the code? I am unable to grasp the logic that you are using.

Anyway, I am sharing a very simple approach with you, have a look at that as well.
Every character has an ascii value associated with it, from 0-255. So we can make a frequence array of size 256 and store the frequency of the elements in that array. The indices of the array indicate the ascii value of the character, and the value stored in the array indicate its frequency. Alternatively you can use a map (key-value pairs) as well. Now you can iterate over your frequency array or map and see which character has the highest frequency.

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.