#P2562. ABC Gene Encoding

    ID: 15831 Type: Default 1000ms 256MiB

ABC Gene Encoding

ABC Gene Encoding

On Super Samuel, every Kitty cat's gene sequence has a length that is a power of 2 and is composed solely of two different genetic units: 0 and 1. To facilitate analysis and reduce storage, Professor Coco invented the ABC encoding scheme.

The encoding works as follows:

1. Initially, convert each character in the binary string to a letter by mapping 0 \to A and 1 \to B.

2. Then, repeatedly combine the string by pairing adjacent characters and replacing each pair \( (x,y) \) with a single character using the rule $$ f(x,y)=\begin{cases} x &\text{if } x=y, \\ {\{A, B, C\} \setminus \{x,y\}} &\text{if } x\neq y. \end{cases} $$ Continue this process until only one character remains. This final character is the ABC encoded gene.

Your task is to compute the ABC encoding given the initial binary gene string.

inputFormat

The input consists of a single line containing a non-empty string S that only consists of characters 0 and 1. The length of S is a power of 2.

outputFormat

Output a single character which is the result of the ABC encoding.

sample

01
C