DICTIONARY self review 
1. ν΄κ²° μλ κ³Όμ
κ·Έλνλ₯Ό λ§λ€μ΄ μ΄λ μνλ²³μ΄ μ νλμ΄μΌ νλμ§ ν΄κ²°νκ³ μ νμμ΅λλ€.
2. μμ±ν μ½λμ μ€λͺ
def makegraph(word,p):
for j in range(1,N):
i=j-1
l=min(len(word[i]),len(word[j]))
for k in range(l):
if word[i][k]==word[j][k]:
continue
a=ord(word[i][k])-ord('a')
b=ord(word[j][k])-ord('a')
p[a][b]=1
break
def dfs(x):
check[x]=True
for nx in range(26):
if p[x][nx]==1 and not check[nx]:
dfs(nx)
ans.append(x)
def makeResult():
ans.reverse()
for i in range(26):
for j in range(i+1,26):
if p[ans[j]][ans[i]]:
return False
return ans
C=int(input())
for _ in range(C):
N=int(input())
word=[]
ans=[]
p=[[0]*27 for _ in range(27)]
check=[False]*27
for x in range(N):
word.append(input().rstrip())
makegraph(word,p)
for i in range(26):
if check[i]==False:
dfs(i)
if makeResult()==False:
print("INVALID HYPOTHESIS")
else:
ans=list(map(lambda x : chr(ord('a')+x),ans))
ans.reverse()
print(''.join(ans))
3. λ§ν μ λ° κ°μ μ¬ν
μΆλ ₯μ΄ μλλλ‘ λμ€μ§ μμ΅λλ€.. λ€μ μλν΄λ΄μΌν κ² κ°μ΅λλ€.
DICTIONARY self review
1. ν΄κ²° μλ κ³Όμ
κ·Έλνλ₯Ό λ§λ€μ΄ μ΄λ μνλ²³μ΄ μ νλμ΄μΌ νλμ§ ν΄κ²°νκ³ μ νμμ΅λλ€.
2. μμ±ν μ½λμ μ€λͺ
3. λ§ν μ λ° κ°μ μ¬ν
μΆλ ₯μ΄ μλλλ‘ λμ€μ§ μμ΅λλ€.. λ€μ μλν΄λ΄μΌν κ² κ°μ΅λλ€.