Language: C++

#include<bits/stdc++.h>
#define RI register int
#define CI const int&
using namespace std;
const int N=64;
struct data
{
	int c,lst; string s;
	friend inline bool operator < (const data& A,const data& B)
	{
		return A.c>B.c;
	}
}a[N];
int n; string s; bool flag; priority_queue <data> q;
inline char dgt_ch(CI x)
{
	if (x<=26) return 'a'+x-1; else if (x<=52) return 'A'+x-27; else return '0'+x-53;
}
inline int query(string& s)
{
	cout<<"? "<<s<<'\n'; fflush(stdout);
	int res; cin>>res; return res;
}
int main()
{
	RI i,j; for (i=1;i<=62;++i)
	{
		s=dgt_ch(i); int res=query(s); if (!n) n=res;
		else if (n!=res) n=max(n,res),flag=1;
	}
	if (!flag) ++n; for (i=1;i<=62;++i)
	{
		for (s="",j=1;j<=n;++j) s+=dgt_ch(i); a[i].c=n-query(s);
		for (j=1;j<=a[i].c;++j) a[i].s+=dgt_ch(i); a[i].lst=n-a[i].c; if (a[i].c) q.push(a[i]);
	}
	while (q.size()>1)
	{
		data A=q.top(); q.pop(); data B=q.top(); q.pop();
		//cout<<A.s<<' '<<B.s<<'\n'; fflush(stdout);
		for (i=j=0;i<=A.s.length();++i) if (j<B.c)
		{
			A.s.insert(i,1,B.s[j]); int res=query(A.s);
			if (res<A.lst) A.lst=res,++A.c,++j; else A.s.erase(i,1);
		}
		q.push(A);
	}
	cout<<"! "<<q.top().s<<'\n'; return 0;
}

Compiler output:
a.cc:14:49: error: template argument 1 is invalid
   14 | int n; string s; bool flag; priority_queue <data> q;
      |                                                 ^
a.cc:14:49: error: template argument 2 is invalid
a.cc:14:49: error: template argument 3 is invalid
a.cc: In function 'int main()':
a.cc:26:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   26 |         RI i,j; for (i=1;i<=62;++i)
      |            ^
a.cc:26:14: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   26 |         RI i,j; for (i=1;i<=62;++i)
      |              ^
a.cc:34:93: error: request for member 'push' in 'q', which is of non-class type 'int'
   34 |                 for (j=1;j<=a[i].c;++j) a[i].s+=dgt_ch(i); a[i].lst=n-a[i].c; if (a[i].c) q.push(a[i]);
      |                                                                                             ^~~~
a.cc:36:18: error: request for member 'size' in 'q', which is of non-class type 'int'
   36 |         while (q.size()>1)
      |                  ^~~~
a.cc:38:17: error: reference to 'data' is ambiguous
   38 |                 data A=q.top(); q.pop(); data B=q.top(); q.pop();
      |                 ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/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:6:8: note:                 'struct data'
    6 | struct data
      |        ^~~~
a.cc:38:35: error: request for member 'pop' in 'q', which is of non-class type 'int'
   38 |                 data A=q.top(); q.pop(); data B=q.top(); q.pop();
      |                                   ^~~
a.cc:38:42: error: reference to 'data' is ambiguous
   38 |                 data A=q.top(); q.pop(); data B=q.top(); q.pop();
      |                                          ^~~~
/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:6:8: note:                 'struct data'
    6 | struct data
      |        ^~~~
a.cc:38:60: error: request for member 'pop' in 'q', which is of non-class type 'int'
   38 |                 data A=q.top(); q.pop(); data B=q.top(); q.pop();
      |                                                            ^~~
a.cc:40:31: error: 'A' was not declared in this scope
   40 |                 for (i=j=0;i<=A.s.length();++i) if (j<B.c)
      |                               ^
a.cc:40:55: error: 'B' was not declared in this scope
   40 |                 for (i=j=0;i<=A.s.length();++i) if (j<B.c)
      |                                                       ^
a.cc:45:19: error: request for member 'push' in 'q', which is of non-class type 'int'
   45 |                 q.push(A);
      |                   ^~~~
a.cc:45:24: error: 'A' was not declared in this scope
   45 |                 q.push(A);
      |                        ^
a.cc:47:23: error: request for member 'top' in 'q', which is of non-class type 'int'
   47 |         cout<<"! "<<q.top().s<<'\n'; return 0;
      |                       ^~~