AtCoder Beginner Contest 058
C
Dubious Document
AtCoder
⌀ 680
原题
← BD →
翻译中…

Problem Statement

翻译中…

Snuke loves "paper cutting": he cuts out characters from a newspaper headline and rearranges them to form another string.

翻译中…

He will receive a headline which contains one of the strings $S_1,...,S_n$ tomorrow. He is excited and already thinking of what string he will create. Since he does not know the string on the headline yet, he is interested in strings that can be created regardless of which string the headline contains.

翻译中…

Find the longest string that can be created regardless of which string among $S_1,...,S_n$ the headline contains. If there are multiple such strings, find the lexicographically smallest one among them.

翻译中…

Constraints

翻译中…
  • $1 \leq n \leq 50$
  • $1 \leq |S_i| \leq 50$ for every $i = 1, ..., n$.
  • $S_i$ consists of lowercase English letters (a - z) for every $i = 1, ..., n$.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

n
S_1
...
S_n

翻译中…

Output

翻译中…

Print the lexicographically smallest string among the longest strings that satisfy the condition. If the answer is an empty string, print an empty line.

翻译中…

样例

Input #1
3
cbaa
daacc
acacac
Output #1
aac
The strings that can be created from each of `cbaa`, `daacc` and `acacac`, are `aa`, `aac`, `aca`, `caa` and so forth. Among them, `aac`, `aca` and `caa` are the longest, and the lexicographically smallest of these three is `aac`.
Input #2
3
a
aa
b
Output #2

The answer is an empty string.
题目信息
题号
arc071_a
时间限制
2 s
内存限制
256 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。