Language: C++

#include<cstdlib>
#include<vector>
#include<string>
#include<algorithm>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<cstdio>
#include<iostream>
#include<vector>
#define MAXN 1000
using namespace std;
typedef long long ll;
char data[6000];
ll index[26][5100]={0};
ll same[26][5100]={0};
ll lens[26][5100]={0};
ll cnt[26]={0};
int main()
{
	ios::sync_with_stdio(false);
	//freopen("../in", "r", stdin);
	//freopen("../out", "w", stdout);
	ll n;
	cin>>n;
	cin>>data;
	ll mymax=0;
	for(ll i=0;i<n;i++)
	{
		index[data[i]-'a'][cnt[data[i]-'a']]=i;
		cnt[data[i]-'a']++;
	}
	for(ll i=0;i<26;i++)
			for(ll k=1;k<cnt[i];k++)
			{
				ll len=1;
				while(index[i][0]+len<index[i][k]&&(data[index[i][0]+len]==data[index[i][k]+len]))
				{
					len++;
				}
				lens[i][k]=len;//不相等处
			}
	for(ll i=0;i<26;i++)
		for(ll j=1;j<cnt[i];j++)
			for(ll k=j+1;k<cnt[i];k++)
			{
				if(same[i][j]==same[i][k])
				{
					if(lens[i][j]==lens[i][k])
					{
						ll len=lens[i][k];
						while(index[i][j]+len<index[i][k]&&(data[index[i][j]+len]==data[index[i][k]+len]))
						{
							len++;
						}
						lens[i][k]=len;
						same[i][k]=j;
					}
				}
			}
	for(ll i=0;i<26;i++)
		for(ll k=1;k<cnt[i];k++)
			mymax=max(lens[i][k],mymax);
	cout<<mymax<<endl;
	return 0;
}

Compiler output:
a.cc:16:18: error: 'll index [26][5100]' redeclared as different kind of entity
   16 | ll index[26][5100]={0};
      |                  ^
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from a.cc:5:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int main()':
a.cc:27:14: error: reference to 'data' is ambiguous
   27 |         cin>>data;
      |              ^~~~
In file included from /usr/include/c++/14/vector:69,
                 from a.cc:2:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:15:6: note:                 'char data [6000]'
   15 | char data[6000];
      |      ^~~~
a.cc:31:23: error: reference to 'data' is ambiguous
   31 |                 index[data[i]-'a'][cnt[data[i]-'a']]=i;
      |                       ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:15:6: note:                 'char data [6000]'
   15 | char data[6000];
      |      ^~~~
a.cc:31:40: error: reference to 'data' is ambiguous
   31 |                 index[data[i]-'a'][cnt[data[i]-'a']]=i;
      |                                        ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:15:6: note:                 'char data [6000]'
   15 | char data[6000];
      |      ^~~~
a.cc:32:21: error: reference to 'data' is ambiguous
   32 |                 cnt[data[i]-'a']++;
      |                     ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:15:6: note:                 'char data [6000]'
   15 | char data[6000];
      |      ^~~~
a.cc:38:44: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript
   38 |                                 while(index[i][0]+len<index[i][k]&&(data[index[i][0]+len]==data[index[i][k]+len]))
      |                                            ^
a.cc:38:60: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript
   38 |                                 while(index[i][0]+len<index[i][k]&&(data[index[i][0]+len]==data[index[i][k]+len]))
      |                                                            ^
a.cc:38:69: error: reference to 'data' is ambiguous
   38 |                                 while(index[i][0]+len<index[i][k]&&(data[index[i][0]+len]==data[index[i][k]+len]))
      |                                                                     ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:15:6: note:                 'char data [6000]'
   15 | char data[6000];
      |      ^~~~
a.cc:38:79: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript
   38 |                                 while(index[i][0]+len<index[i][k]&&(data[index[i][0]+len]==data[index[i][k]+len]))
      |                                                                               ^
a.cc:38:92: error: reference to 'data' is ambiguous
   38 |                                 while(index[i][0]+len<index[i][k]&&(data[index[i][0]+len]==data[index[i][k]+len]))
      |                                                                                            ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:15:6: note:                 'char data [6000]'
   15 | char data[6000];
      |      ^~~~
a.cc:38:102: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript
   38 |                                 while(index[i][0]+len<index[i][k]&&(data[index[i][0]+len]==data[index[i][k]+len]))
      |                                                                                                      ^
a.cc:53:60: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript
   53 |                                                 while(index[i][j]+len<index[i][k]&&(data[index[i][j]+len]==data[index[i][k]+len]))
      |                                                            ^
a.cc:53:76: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript
   53 |                                                 while(index[i][j]+len<index[i][k]&&(data[index[i][j]+len]==data[index[i][k]+len]))
      |                                                                            ^
a.cc:53:85: error: reference to 'data' is ambiguous
   53 |                                                 while(index[i][j]+len<index[i][k]&&(data[index[i][j]+len]==data[index[i][k]+len]))
      |                                                                                     ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_