C++#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=275;
string s,getstring_dp[N][N];
map<string,string>mp;
map<string,int>mp2;
int check(string s)
{
if(mp2[s]!=0)
{
return mp2[s];
}
int c0=0,c1=0;
for(int i=0;i<s.size();i++)
{
if(s[i]=='0')
{
if(c1!=0)
{
mp2[s]=3;
return 3;
}
c0++;
}
else
{
if(c0!=0)
{
mp2[s]=3;
return 3;
}
c1++;
}
}
if(c0==0)
{
return 2;
}
else
{
return 1;
}
}
string getstring(int lt,int rt)
{
if(getstring_dp[lt][rt]!="")
{
return getstring_dp[lt][rt];
}
string ans="";
for(int i=lt;i<=rt;i++)
{
ans+=s[i];
}
getstring_dp[lt][rt]=ans;
return ans;
}
string dfs_dp(int l,int r)
{
if(l>r)
{
return "";
}
if(mp[getstring(l,r)]!="")
{
return mp[getstring(l,r)];
}
int n=check(getstring(l,r));
if(n==1)
{
return "A";
}
if(n==2)
{
return "B";
}
int mid=(l+r)/2;
return "C"+dfs_dp(l,mid)+dfs_dp(mid+1,r);
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin>>s;
cout<<dfs_dp(0,(int)s.size()-1);
return 0;
}