ACfun

Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)

Problem Description

As a former ACMer, "AC" is a special abbreviated word which can bring much pleasure to me. Sometimes it means everything.
This problem is about "AC".
One day, I write a long string S on the paper which contains "A" and "C". Now I want to find a lexicographic minimum string T satisfied that T is distinct with all substring of S.

Input

The first line of input file contains an integer T indicating the number of case.
In each test case:
Input a string S consist of "A" and "C". The length of S is not large than 100.

Output

For each test case:
You should output the string T meet the condition.

Sample Input

1
ACAC

Sample Output

AA

Source

dut200901102

Manager

Information
Solved Number401
Submit Number1079
Problem Tags
implementation
strings
No tag edit access
温馨提示:AC后可以编辑标签哦. ^-^
Login
LoginCancel