Language: C++

#include<stdio.h>
#include<string.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
int n,cnt[62];
const char alphabet[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
int qry(char s[])
{
  printf("%s%s\n","? ",s);
  int v=0;if(~scanf("%d",&v))return v;else return -1;
}
int subsequence(char s[]){return (int)strlen(s)+qry(s)==n;}
char* combine(const char a[],const char b[])
{
  char *ret;int i=0,j=0,s1=strlen(a),s2=strlen(b);
  if(!s1||!s2)return strcat(a,b);
  for(;i<s1||j<s2;)
  {
    char *str;strcpy(str,a);memmove(str+i+2,b+j,s2-j);
    if(i<s1&&(j==s2||subsequence(str)))ret=strcat(ret,a[i++]);
    else ret=strcat(ret,b[j++]);
  }
  return ret;
}
char* solve(int l,int r)
{
  if(l==r){char str[cnt[l]];memset(str,alphabet[l],sizeof(str));return str;}
  int mid=(l+r)>>1;
  return combine(solve(l,mid),solve(mid+1,r));
}
int main()
{
  for(int i=0;i<62;i++){char str[128];memset(str,alphabet[i],sizeof(str));cnt[i]=128-qry(str),n+=cnt[i];}
  char *ans=solve(0,61);
  return printf("%s%s\n","! ",ans),0;
}

Compiler output:
a.cc: In function 'char* combine(const char*, const char*)':
a.cc:16:29: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
   16 |   if(!s1||!s2)return strcat(a,b);
      |                             ^
      |                             |
      |                             const char*
In file included from a.cc:2:
/usr/include/string.h:149:39: note:   initializing argument 1 of 'char* strcat(char*, const char*)'
  149 | extern char *strcat (char *__restrict __dest, const char *__restrict __src)
      |                      ~~~~~~~~~~~~~~~~~^~~~~~
a.cc:20:60: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   20 |     if(i<s1&&(j==s2||subsequence(str)))ret=strcat(ret,a[i++]);
      |                                                       ~~~~~^
      |                                                            |
      |                                                            char
/usr/include/string.h:149:70: note:   initializing argument 2 of 'char* strcat(char*, const char*)'
  149 | extern char *strcat (char *__restrict __dest, const char *__restrict __src)
      |                                               ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
a.cc:21:30: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   21 |     else ret=strcat(ret,b[j++]);
      |                         ~~~~~^
      |                              |
      |                              char
/usr/include/string.h:149:70: note:   initializing argument 2 of 'char* strcat(char*, const char*)'
  149 | extern char *strcat (char *__restrict __dest, const char *__restrict __src)
      |                                               ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
a.cc: In function 'char* solve(int, int)':
a.cc:27:72: warning: address of local variable 'str' returned [-Wreturn-local-addr]
   27 |   if(l==r){char str[cnt[l]];memset(str,alphabet[l],sizeof(str));return str;}
      |                                                                        ^~~
a.cc:27:17: note: declared here
   27 |   if(l==r){char str[cnt[l]];memset(str,alphabet[l],sizeof(str));return str;}
      |                 ^~~