백준문제풀이/문자열

1157 -- 이 부분 헷갈리는거 많음

포비용 2022. 12. 16. 19:53
import sys

sys.stdin = open("input.txt","rt")

alpha = "abcdefghijklmnopqrstuvwxyz"

word = sys.stdin.readline().strip()
ans_list = []

max = -1
ans = 0
for i in alpha:

    cnt = word.count(i)

    if cnt > max:
        max = cnt
        ans_list.append(i.upper())


for j in alpha:

    cnt = word.count(j)

    if max == cnt:
        ans += 1



if ans > 1:
    print("?")


else:
    print(ans_list[1])