OtherOA #17
Most Unique Elements (Part 1 :)
Estimated EasyJudge-ready
Select the least concentrated strings by the ratio of each string's highest character frequency, then keep only the characters that appear only in the selected set. The source's only example determines the return rule; this site adds the input protocol.
Input
The first line contains n (1≤n≤1000), followed by n lines of non-empty strings containing only lowercase English letters, each of length 1..1000.
Output
First select all strings with the smallest ratio of the most common character; output the characters in these strings that do not appear in any unselected string, keeping repeated characters in the original input order of the selected strings and their order within each string.
Example 1
Input:
3
aba
ab
abbcdd
Output:
cdd
Example 2
Input:
3
aab
cc
bbd
Output:
aabbbd
Example 3
Input:
2
abca
de
Output:
abcade
Editorial
Loading solution…