문제/백준_파이썬

50. 1157(단어공부)

sm_hope 2022. 5. 16. 21:46
S = input()
S = S.upper()
max_n = 0
max_s = ""

for i in set(S) :
    A = S.count(i)

    if A > max_n :
        max_n = A
        max_s = i  

    elif A == max_n :
        max_s = "?"

print(max_s)

count와 set 사용

 

______.count("A") : A가 문자열에서 몇번이나 나오는지 검사한다.

set() : 중복값 제거