Difficult Characters
Practice
3.7 (368 votes)
Ad Hoc
Approved
Easy
Implementation
Ready
Sorting
Problem
48% Success 6614 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Yesterday while Omar was trying to learn English, he saw that there are letters repeated many times in words while some other letters repeated only few times or not repeated at all!

Of course anyone can memorize the letters (repeated many times) better than the letters repeated few times, so Omar will concatenate all the words in the context he has, and try to know the difficulty of each letter according to the number of repetitions of each letter.

So Omar has now the whole context and wants to arrange the letters from the most difficult letter (repeated few times) to the less difficult letter (repeated many times).

If there are 2 letters with the same level of difficulty, the letter with higher value of ASCII code will be more difficult.

Input Format:
Given an integer (T), \(1 \le T \le 10\) (number of test cases).
For each test case:
Given a string of (lower English characters), \(1 \le size\; of\; string \le 10 ^ 6\).
(each string in a new line).

Output Format:
Output the English lower case characters from the most difficult letter to the less difficult letter. (leave a space between 2 successive letters) (Output each test case in a separate line).

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
26 votes
Tags:
AlgorithmsEasy
Points:20
16 votes
Tags:
Data StructuresEasyHash MapsHash Tables
Points:20
19 votes
Tags:
AlgorithmsData StructuresEasyHash MapsHash TablesSets