QOJ.ac

QOJ

时间限制: 1.0 s 内存限制: 32 MB 总分: 100

#17009. ABECEDA

统计

有人发现了一份用某种未知字母表书写的单词列表。已知这些单词是按字母顺序排列的。

请编写一个程序,找出所使用字母的唯一字母顺序,或者确定不存在这样的顺序,亦或是存在多种可能的顺序。

输入格式

输入的第一行包含一个正整数 $N$ ($N \le 100$),表示单词的数量。

接下来的 $N$ 行包含发现的单词列表,每行一个单词。每个单词最多由 10 个小写字母组成。

输出格式

输出的唯一一行应当包含按字母顺序排列的所有出现过的字母。如果不存在这样的顺序,输出 !。如果存在多种可能的顺序,输出 ?

样例

输入样例 1

5
ula
uka
klua
kula
al

输出样例 1

luka

输入样例 2

4
jaja
baba
baja
beba

输出样例 2

!

输入样例 3

3
marko
darko
zarko

输出样例 3

?

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.