CF1907B.YetnotherrokenKeoard
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Polycarp has a problem — his laptop keyboard is broken.
Now, when he presses the 'b' key, it acts like an unusual backspace: it deletes the last (rightmost) lowercase letter in the typed string. If there are no lowercase letters in the typed string, then the press is completely ignored.
Similarly, when he presses the 'B' key, it deletes the last (rightmost) uppercase letter in the typed string. If there are no uppercase letters in the typed string, then the press is completely ignored.
In both cases, the letters 'b' and 'B' are not added to the typed string when these keys are pressed.
Consider an example where the sequence of key presses was "ARaBbbitBaby". In this case, the typed string will change as follows: "" A "A" R "AR" a "ARa" B "Aa" b "A" b "A" i "Ai" t "Ait" B "it" a "ita" b "it" y "ity".
Given a sequence of pressed keys, output the typed string after processing all key presses.
输入格式
The first line of the input data contains an integer t ( 1≤t≤1000 ), the number of test cases in the test.
The following contains t non-empty lines, which consist of lowercase and uppercase letters of the Latin alphabet.
It is guaranteed that each line contains at least one letter and the sum of the lengths of the lines does not exceed 106 .
输出格式
For each test case, output the result of processing the key presses on a separate line. If the typed string is empty, then output an empty line.
输入输出样例
输入#1
12 ARaBbbitBaby YetAnotherBrokenKeyboard Bubble Improbable abbreviable BbBB BusyasaBeeinaBedofBloomingBlossoms CoDEBARbIES codeforces bobebobbes b TheBBlackbboard
输出#1
ity YetnotherrokenKeoard le Imprle revile usyasaeeinaedofloominglossoms CDARIES codeforces es helaoard