I want help in this as it is not passing one test case

#include
#include
using namespace std;
void no_of_freq(string s){
int n=s.length();
int count=0;
int j=0;
int freq[123]={0};
for(int i=0;i<n;i++){
int val=s[i];
freq[val]++;

}
int a[123];
for(int i=0;i<123;i++){
	if(freq[i]>0){
        
	a[j]=freq[i];
	count++;
    j++;
	}
}
int maxi=INT_MIN;
int pos=0;
for(int i=0;i<count;i++){
    int val=a[i];
    if(val>maxi){
        maxi=val;
        pos=i;
    }
}
cout<<s[pos];

}
int main() {
string s;
getline(cin,s);
no_of_freq(s);
return 0;
}

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.