Language: C++

#include<cstdio>
#include<iostream>
#include<string>
#include<queue>
#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:17:49: error: template argument 1 is invalid
   17 | int n; string s; bool flag; priority_queue <data> q;
      |                                                 ^
a.cc:17:49: error: template argument 2 is invalid
a.cc:17:49: error: template argument 3 is invalid
a.cc: In function 'int main()':
a.cc:29:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   29 |         RI i,j; for (i=1;i<=62;++i)
      |            ^
a.cc:29:14: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   29 |         RI i,j; for (i=1;i<=62;++i)
      |              ^
a.cc:37:93: error: request for member 'push' in 'q', which is of non-class type 'int'
   37 |                 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:39:18: error: request for member 'size' in 'q', which is of non-class type 'int'
   39 |         while (q.size()>1)
      |                  ^~~~
a.cc:41:17: error: reference to 'data' is ambiguous
   41 |                 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/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:9:8: note:                 'struct data'
    9 | struct data
      |        ^~~~
a.cc:41:35: error: request for member 'pop' in 'q', which is of non-class type 'int'
   41 |                 data A=q.top(); q.pop(); data B=q.top(); q.pop();
      |                                   ^~~
a.cc:41:42: error: reference to 'data' is ambiguous
   41 |                 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:9:8: note:                 'struct data'
    9 | struct data
      |        ^~~~
a.cc:41:60: error: request for member 'pop' in 'q', which is of non-class type 'int'
   41 |                 data A=q.top(); q.pop(); data B=q.top(); q.pop();
      |                                                            ^~~
a.cc:43:31: error: 'A' was not declared in this scope
   43 |                 for (i=j=0;i<=A.s.length();++i) if (j<B.c)
      |                               ^
a.cc:43:55: error: 'B' was not declared in this scope
   43 |                 for (i=j=0;i<=A.s.length();++i) if (j<B.c)
      |                                                       ^
a.cc:48:19: error: request for member 'push' in 'q', which is of non-class type 'int'
   48 |                 q.push(A);
      |                   ^~~~
a.cc:48:24: error: 'A' was not declared in this scope
   48 |                 q.push(A);
      |                        ^
a.cc:50:23: error: request for member 'top' in 'q', which is of non-class type 'int'
   50 |         cout<<"! "<<q.top().s<<'\n'; return 0;
      |                       ^~~