CF1251A.Broken Keyboard

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Recently Polycarp noticed that some of the buttons of his keyboard are malfunctioning. For simplicity, we assume that Polycarp's keyboard contains 2626 buttons (one for each letter of the Latin alphabet). Each button is either working fine or malfunctioning.

To check which buttons need replacement, Polycarp pressed some buttons in sequence, and a string ss appeared on the screen. When Polycarp presses a button with character cc , one of the following events happened:

  • if the button was working correctly, a character cc appeared at the end of the string Polycarp was typing;
  • if the button was malfunctioning, two characters cc appeared at the end of the string.

For example, suppose the buttons corresponding to characters a and c are working correctly, and the button corresponding to b is malfunctioning. If Polycarp presses the buttons in the order a, b, a, c, a, b, a, then the string he is typing changes as follows: a \rightarrow abb \rightarrow abba \rightarrow abbac \rightarrow abbaca \rightarrow abbacabb \rightarrow abbacabba.

You are given a string ss which appeared on the screen after Polycarp pressed some buttons. Help Polycarp to determine which buttons are working correctly for sure (that is, this string could not appear on the screen if any of these buttons was malfunctioning).

You may assume that the buttons don't start malfunctioning when Polycarp types the string: each button either works correctly throughout the whole process, or malfunctions throughout the whole process.

输入格式

The first line contains one integer tt ( 1t1001 \le t \le 100 ) — the number of test cases in the input.

Then the test cases follow. Each test case is represented by one line containing a string ss consisting of no less than 11 and no more than 500500 lowercase Latin letters.

输出格式

For each test case, print one line containing a string resres . The string resres should contain all characters which correspond to buttons that work correctly in alphabetical order, without any separators or repetitions. If all buttons may malfunction, resres should be empty.

输入输出样例

  • 输入#1

    4
    a
    zzaaz
    ccff
    cbddbb
    

    输出#1

    a
    z
    
    bc
    
首页