Can i have better solution for string max frequency its passing only few testcases

#include<bits/stdc++.h>
using namespace std;
int main(){
char c[1004];
cin>>c;
unordered_map<char, int> dap;
for(int i=0;i<strlen©;i++){
dap[c[i]]++;
}
for(auto x: dap) {
if(x.second >=strlen©/2){
cout<<x.first<<endl;
break;
}
}
}

@kishoretaru read question carefully you have to print char with max frequency but here your are printing char with frequency greater than strlen©/2.

How can i get the max frequecy of the character within that loop
and method is there ah

@kishoretaru look at this code you will get it https://ide.codingblocks.com/s/238484

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.