306783: CF1251A. Broken Keyboard
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Broken Keyboard
题意翻译
最近,$Polycarp$发现他的键盘上的一些按键出现了问题。简单来说,我们假设$Polycarp$的键盘上只有$26$个按键(对应$26$个拉丁字母)。每一个按钮不是正常工作就是发生了故障。 为了找到哪些按键是出现问题的,$Ploycrap$按照一定顺序按下了一些字母,在屏幕上出现了一个字符串。当$Polycarp$按下一个带有字母$c$的按键的时候,就会发生以下两种情况的一种: - 如果这个按键正常工作,那么$Polycarp$打出的字符串的结尾就会多出**一个**字母$c$。 - 如果这个按键出现了问题,那么$Polycarp$打出的字符串的结尾就会多出**两个**字母$c$ 举例来说,假设带有字母$a$和$c$的按键正常工作,而带有$b$的按键发生故障。如果$Polycarp$按照$a,b,a,c,a,b,a$的顺序按下按键,那么屏幕上的字符串就会按照:$a -> abb -> abbac ->abbaca->abbacabb->abbacabba$变化。 现在给你一个在$Polycrap$一番按键之后得到的字符串,请你帮他找出来有哪些按键可以确定是正常工作的(换言之,如果这些按键不能正常工作,则不会出现这个字符串)。 您可以假设在$Polycarp$键入字符串的时候按钮都没有出现故障。每一个按钮要么在整个过程中都可以正常工作,要么在整个过程中都出现问题。 ------ **简洁题面:** 现在键盘上有$26$个字母对应的按键,一些可以正常工作,一些出现了问题。出现问题的按键按下一次会出现两个相同的该字母。如果$c$出现问题,那么我们按下它就会出现$cc$。现在给你一个字符串,请你判断有哪些字母所对应的按键一定是正常工作的。题目描述
Recently Polycarp noticed that some of the buttons of his keyboard are malfunctioning. For simplicity, we assume that Polycarp's keyboard contains $ 26 $ 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 $ s $ appeared on the screen. When Polycarp presses a button with character $ c $ , one of the following events happened: - if the button was working correctly, a character $ c $ appeared at the end of the string Polycarp was typing; - if the button was malfunctioning, two characters $ c $ 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 $ s $ 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 $ t $ ( $ 1 \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 $ s $ consisting of no less than $ 1 $ and no more than $ 500 $ lowercase Latin letters.
输出格式
For each test case, print one line containing a string $ res $ . The string $ res $ should contain all characters which correspond to buttons that work correctly in alphabetical order, without any separators or repetitions. If all buttons may malfunction, $ res $ should be empty.
输入输出样例
输入样例 #1
4
a
zzaaz
ccff
cbddbb
输出样例 #1
a
z
bc