#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
vector<long long> a(26);
cin>>s;
for(long long i=0;i<s.length();i++)
{
int x = (int)(s[i]-'a');
a[x]++;
}
long long mx=-1;
char c;
for(long long i=0;i<26;i++)
{
if(mx<a[i])
{
mx=a[i];
c='a' +i;
}
}
cout<<c;
return 0;
}

Time Complexity : O(n)

There are 2 more approaches :

1) We can sort the string, keep a variable of count and whenever there is a change in character just compare the count with max, Time-O(nlogn)

2) Use a hashmap intead of an array to store the frequency, the key in that case will be a character and value will be an integer storing the frequency of that character , time - O(n) .