#K86667. Find Common Characters
Find Common Characters
Find Common Characters
You are given a list of strings. Your task is to find all the characters that appear in every string (including duplicates). For each character, the number of times it appears in the output should be equal to the minimum number of times it occurs in any one of the strings.
For example, if the input is "bella"
, "label"
, and "roller"
, then the character 'l'
appears at least twice in every string and 'e'
appears once in every string. Therefore, one acceptable answer is e l l
(order does not matter).
If there are no characters common to all strings, output an empty line.
Note: Characters are limited to lowercase English letters.
inputFormat
The first line contains an integer n, which is the number of strings.
The following n lines each contain a non-empty string consisting of lowercase English letters.
outputFormat
Output the common characters separated by a single space. The characters should be printed in lexicographical order. If there are no common characters, output an empty line.
## sample3
bella
label
roller
e l l
</p>