시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 605 39 28 20.588%

문제

알고스팟어는 알고스팟 커뮤니티에서 사용하는 언어다. 이 언어는 영어 알파벳을 사용하지만, 영어와 알파벳 순서는 다르다.

알고스팟어의 알파벳 사전 순으로 정렬되어 있는 단어의 목록이 주어졌을 때, 알고스팟어의 알파벳 순서를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 단어의 개수 N (N ≤ 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

?
W3sicHJvYmxlbV9pZCI6IjI4NDgiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM1NGNcdWFjZTBcdWMyYTRcdWQzMWZcdWM1YjQiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YzU0Y1x1YWNlMFx1YzJhNFx1ZDMxZlx1YzViNFx1YjI5NCBcdWM1NGNcdWFjZTBcdWMyYTRcdWQzMWYgXHVjZWU0XHViYmE0XHViMmM4XHVkMmYwXHVjNWQwXHVjMTFjIFx1YzBhY1x1YzZhOVx1ZDU1OFx1YjI5NCBcdWM1YjhcdWM1YjRcdWIyZTQuIFx1Yzc3NCBcdWM1YjhcdWM1YjRcdWIyOTQgXHVjNjAxXHVjNWI0IFx1YzU0Y1x1ZDMwY1x1YmNiM1x1Yzc0NCBcdWMwYWNcdWM2YTlcdWQ1NThcdWM5YzBcdWI5Y2MsIFx1YzYwMVx1YzViNFx1YzY0MCBcdWM1NGNcdWQzMGNcdWJjYjMgXHVjMjFjXHVjMTFjXHViMjk0IFx1Y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yBzdWNoIG9yZGVyaW5nIGV4aXN0cyBvciB0aGF0IHRoZXJlIGlzIG1vcmUgdGhhbiBvbmUgcG9zc2libGUgc29sdXRpb24uPFwvcD5cclxuIiwiaW5wdXQiOiI8cD5UaGUgZmlyc3QgbGluZSBvZiBpbnB1dCBjb250YWlucyBhIHBvc2l0aXZlIGludGVnZXIgTiAoTiAmbGU7IDEwMCksIHRoZSBudW1iZXIgb2Ygd29yZHMuPFwvcD5cclxuXHJcbjxwPlRoZSBmb2xsb3dpbmcgTiBsaW5lcyBjb250YWluIHRoZSBsaXN0IG9mIHdvcmRzIGZvdW5kLCBvbmUgd29yZCBwZXIgbGluZS4gRWFjaCB3b3JkIGNvbnNpc3RzIG9mIGF0IG1vc3QgMTAgbG93ZXJjYXNlIGxldHRlcnMuPFwvcD5cclxuIiwib3V0cHV0IjoiPHA+VGhlIGZpcnN0IGFuZCBvbmx5IGxpbmUgb2Ygb3V0cHV0IHNob3VsZCBjb250YWluIGFsbCBsZXR0ZXJzIGluIGFscGhhYmV0aWMgb3JkZXIuIElmIG5vIHN1Y2ggb3JkZXJpbmcgZXhpc3RzLCBvdXRwdXQgJmxzcXVvOyEmcnNxdW87LiBJZiB0aGVyZSBpcyBtb3JlIHRoYW4gb25lIHNvbHV0aW9uLCBvdXRwdXQgJmxzcXVvOz8mcnNxdW87LjxcL3A+XHJcbiIsImhpbnQiOiIiLCJvcmlnaW5hbCI6IjEiLCJwcm9ibGVtX2xhbmdfY29kZSI6Ilx1YzYwMVx1YzViNCJ9XQ==

출처

Contest > Croatian Open Competition in Informatics > COCI 2010/2011 > Contest #6 4번

  • 데이터를 추가한 사람: alex9801
  • 문제를 번역한 사람: baekjoon
  • 문제의 오타를 찾은 사람: codeonwort
  • 빠진 조건을 찾은 사람: zmtn94