Language: C++

#include<bits/stdc++.h>

using namespace std;

/*
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/
typedef long long ll ;
const ll mk = 250055;
const ll logn  = 29;
const ll mod = 1e9 + 7;

#define endl             "\n"
#define IOS              ios::sync_with_stdio(0); cin.tie(0);
#define fi               first
#define se               second
#define pii              pair<ll,ll>
#define mp               make_pair
#define pq               priority_queue<int, std::vector<int>, std::greater<int> >
#define rep(i, n)        for(int i = 0 ; i < n ; i++)
#define push_back        pb
 
int n;
vector<int>g[mk];
char ans[mk];
int next[mk][26];
int f[mk], go[mk];
string s;
 
bool down(int &x, const int y) {return x > y ? x = y, 1 : 0;}
 
int main() {
	int i, j;
	cin >>s; n = s.length();
	fill(next[n], next[n] + 26, n);
	for (i = n - 1; i >= 0; -i--) memcpy(next[i], next[i + 1], 204/*my birthday ahihi*/), next[i][s[i] - 97] = i;
	f[n] = 1;
	for (i = n - 1; i >= 0; i--) {
		f[i] = INT_MAX;
		for (j = 0; j < 26; ++j) if (down(f[i], f[ next[i][j] + 1 ])) go[i] = j;
		f[i]++;
	}
	for (j = i = 0; i <= n; i = next[i][ go[i] ] + 1) ans[j++] = go[i] + 97;
	cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:14: error: reference to 'next' is ambiguous
   41 |         fill(next[n], next[n] + 26, n);
      |              ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 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_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:32:5: note:                 'int next [250055][26]'
   32 | int next[mk][26];
      |     ^~~~
a.cc:41:23: error: reference to 'next' is ambiguous
   41 |         fill(next[n], next[n] + 26, n);
      |                       ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:32:5: note:                 'int next [250055][26]'
   32 | int next[mk][26];
      |     ^~~~
a.cc:42:46: error: reference to 'next' is ambiguous
   42 |         for (i = n - 1; i >= 0; -i--) memcpy(next[i], next[i + 1], 204/*my birthday ahihi*/), next[i][s[i] - 97] = i;
      |                                              ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:32:5: note:                 'int next [250055][26]'
   32 | int next[mk][26];
      |     ^~~~
a.cc:42:55: error: reference to 'next' is ambiguous
   42 |         for (i = n - 1; i >= 0; -i--) memcpy(next[i], next[i + 1], 204/*my birthday ahihi*/), next[i][s[i] - 97] = i;
      |                                                       ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:32:5: note:                 'int next [250055][26]'
   32 | int next[mk][26];
      |     ^~~~
a.cc:42:95: error: reference to 'next' is ambiguous
   42 |         for (i = n - 1; i >= 0; -i--) memcpy(next[i], next[i + 1], 204/*my birthday ahihi*/), next[i][s[i] - 97] = i;
      |                                                                                               ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:32:5: note:                 'int next [250055][26]'
   32 | int next[mk][26];
      |     ^~~~
a.cc:46:60: error: reference to 'next' is ambiguous
   46 |                 for (j = 0; j < 26; ++j) if (down(f[i], f[ next[i][j] + 1 ])) go[i] = j;
      |                                                            ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:32:5: note:                 'int next [250055][26]'
   32 | int next[mk][26];
      |     ^~~~
a.cc:49:37: error: reference to 'next' is ambiguous
   49 |         for (j = i = 0; i <= n; i = next[i][ go[i] ] + 1) ans[j++] = go[i] + 97;
      |                                     ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:32:5: note:                 'int next [250055][26]'
   32 | int next[mk][26];
      |     ^~~~