2750Eating Cheeses

2750   Eating Cheeses

题目描述

Jerry has some cheeses. The cheeses have many different tastes. We use different lowercase letters to indicate different tastes. Now, Jerry wants to eat each of them in some order. Besides, Jerry doesn’t want to eat two chesses with same taste continuously. Since there may be multiple solutions, Jerry wants to know the lexicographic smallest one. 

输入格式:

      There are multiple cases. The number of cases will be no more than 50. 

      Each case contains a non-empty string describing Jerry’s cheeses. Its length doesn’t exceed 10000 and only contains lowercase letters.

输出格式:

For each case, if there doesn’t exist any solution, print “QAQ”. Otherwise print cheeses in Jerry’s order.

输入样例 复制
aabb
cc
输出样例 复制
abab
QAQ

说明

4
22
通过提交
时空限制2000ms/32mb
题目来源
评测方式在线评测
题目类型
难        度