티스토리 뷰

알고리즘

백준 알고리즘 1157번 파이썬

real_water 2019. 11. 2. 22:07
small = 'abcdefghijklmnopqrstuvwxyz'
big = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
num = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

word = input()

for i in range(len(word)):
    for j in range(len(small)):
        if word[i] == small[j]:
            num[j] += 1

        if word[i] == big[j]:
            num[j] += 1
Max = 0
x = 0
for l in range(len(num)):

    if num[l] > Max:
        Max = num[l]
        find = big[l]
        x = Max
count = 0
for m in range(len(num)):
    if Max == num[m]:
        count += 1
        if count >= 2:
            find = '?'
            break

print(find)
반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함