String max frequency character

getting wrong output

Hey Atul,
You need to take input from user.U r harcoding input string.
regards
Aman yadav

but first it should work well with given input

thanks , now i get correct output…
but why in previous code i am not able to get correct output ?

Hello Atul actually right now i don’t have acces to my laptop.I have said you the obvious error i have seen. Though i will tell u later why ur code was not working once I get access to my laptop.

hello Atul ,
your earlier code was also correct. if u see u have given “aattuullll” as your input string and output u get is l which is correct.
confusion- i think you are giving input in coding blocks ide and expecting result for the same but remember you have hardcoded the input string "“aattuullll” thats why on every execution u are getting l as output.
I hope now your doubt get cleared.if so pls mark ur doubt resolved
regards
Aman yadav

1 Like

Hey @aattuull there is nothing wrong with the logic, the problem is that you are not taking input from user. So declare an character array big enough and then use cin to take input from user, like this:
char a[1005];
cin >> a;

1 Like

thanks , my doubt is clear