본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 31663번 Mean Words

by 현장 2024. 6. 10.

-Code

n = int(input())
cnts, sums = [0] * 46, [0] * 46

for _ in range(n):
    s = input()

    for i in range(len(s)):
        sums[i] += ord(s[i])
        cnts[i] += 1

res = ""

for i in range(46):
    if cnts[i] == 0:
        break
    res += chr(sums[i] // cnts[i])

print(res)