提示: 欢迎访问OurACM平台。
Problem 1989 AntiAC

Accept: 68    Submit: 252
Time Limit: 4000 mSec    Memory Limit : 32768 KB

Problem Description

Usually, in programming contests all you wait is “AC” (abbreviation of AekdyCoin).We find that boring.

In this task we do the opposite. We will give you a string consists of only uppercase letters. You should remove some letters so that there is no “AC” in the result string. Return the result string with the longest length. If there is more than one string with the longest length, return lexicographically smallest one.

Input

In the first line there is an integer T, indicates the number of test cases. (T <= 100).In each case, there contains one string. The length of string is no longer than 10000.

Output

For each case, output “Case idx: “ first where idx is the index of the test case start from 1, then output the result string.

Sample Input

3 A ACA ACBWCA

Sample Output

Case 1: A Case 2: AA Case 3: ABWCA

Source

FOJ有奖月赛-2010年11月

Submit  Back  Status  Discuss