#include <iostream>
#include <string>
int main() {
int fr[256] = {0}, max_index = 0;
std::string str;
std::cin >> str;
for (size_t i = 0; i <= str.std::string::length(); ++i) fr[(int)str[i]]++;
for (int i = 0; i <= 255; ++i)
if (fr[i] > fr[max_index]) max_index = i;
std::cout << (char)max_index;
return 0;
}
Please tell me where, I am doing wrong?
Hello @moon i have corrected your code and now it is passing every test case:
i have commented the msitake.
you can check now:
if you have any doubt you can ask here;
Happy Learning!!
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.