Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7+1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;

ll n, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/

ll a[50] = { 0 };

int main()
{
	cin >> s;
	vi vll, vans, vv;
	vc v;
	REP(i, s.size())
	{
		v.push_back(s[i]);
		ll b = v[i] - 97;
		a[b]++;
	}
	REP(i, 26)
	{
		ans = max(ans, a[i]);
	}
	if (ans == 1) {
		cout << (s.size()) / 2 << endl;
		return 0;
	}
	REP(i, 26)
	{
		if (a[i] == ans) {
			vll.push_back(i);
		}
	}
	REP(i, vll.size())
	{
		cnt = 0;
		ll q[50] = { 0 };
		REP(j, v.size())
		{
			if (vll[i] + 97 == v[j]) {
				q[cnt] = j;
				cnt++;
			}
		}
		/*REP(t, cnt)
		{
			cout << q[t] << endl;
		}*/
		sum = q[0];
		REP(t, cnt)
		{
			ll z = q[t + 1] - q[t] - 1;
			sum = max(sum, z);
		}
		sum = max(sum, s.size() - q[cnt - 1]);
		vv.push_back(sum);
	}
	sort(ALL(vv));
	cout << vv[0] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:73:26: error: no matching function for call to 'max(ll&, long long unsigned int)'
   73 |                 sum = max(sum, s.size() - q[cnt - 1]);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:73:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   73 |                 sum = max(sum, s.size() - q[cnt - 1]);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:73:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   73 |                 sum = max(sum, s.size() - q[cnt - 1]);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~