print((function h(n,f,t,v)n--?h(n,v,t,f,h(n,f,v,t),F+=f,T+=t):F)(readline(F=T=''),'A','C','B')+'\n'+T)