#include<iostream>
using namespace std;
typedef struct item
{
char* s;
item* Next;
}item;
class Queue
{
public:
Queue();
void Push(char* s);
char* Pop();
int IsEmpty();
private:
item *front,*end;
};
void Process(char *source);
int main()
{
char s[257];
while(cin>>s)
Process(s);
return 0;
}
void Process(char *source)
{
char *s[257],*k,*i,*temp,*l,*dk,*di;
int pos = 0;
while(1)
{
s[pos] = new char[2];
s[pos][0] = *source++;
if(s[pos][0] == '\0') break;
s[pos][0] = s[pos][0] - '0' + 'A';
s[pos][1] = '\0';
pos++;
}
Queue q;
for(int j=0;j<pos;j++)
q.Push(s[j]);
while(1)
{
k = q.Pop();
if(q.IsEmpty())
{
cout<<k<<endl;
break;
}
i = q.Pop();
if(*(k+1) == '\0' && *(i+1) == '\0' && *k == *i)
{
l = k;
delete(i);
}
else
{
l = new char[512];
temp = l;
di = i; dk = k;
*temp++ = 'C';
while(*k) *temp++ = *k++;
while(*i) *temp++ = *i++;
delete(di);delete(dk);
*temp = '\0';
}
q.Push(l);
}
}
Queue::Queue(){front=end=NULL;}
void Queue::Push(char* s)
{
item* i = new item();
i->s = s;
i->Next = NULL;
if(end != NULL)
{
end->Next = i;
end = i;
}
else
front=end=i;
}
char* Queue::Pop()
{
if(front!=NULL)
{
char* s = front->s,*t=new char[512],*dt = t,*ds = s;
while(*ds) *dt++ = *ds++;
*dt = '\0';
delete(s);
item* i = front->Next;
delete(front);
front = i;
if(front == NULL) end = NULL;
return t;
}
return "";
}
int Queue::IsEmpty(){return front==NULL;}