본문 바로가기
python-algorithm

[백준] 9046

by 무적김두칠 2021. 1. 10.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import sys
myplain="abcdefghijklmnopqrstuvwxyz"
for _ in range(int(sys.stdin.readline())):
    mycnt=[0]*26
    s=sys.stdin.readline()
    for i in range(len(s)-1):
        if s[i] in myplain: mycnt [ord (s[i])-97]+=1
    checkmax=0
    for i in range(26):
        if mycnt[i]==max(mycnt):
            checkmax+=1
            ans=i
    if checkmax ==1 : print(myplain[ans])
    else : print("?")
cs
반응형

'python-algorithm' 카테고리의 다른 글

[백준] 9076  (0) 2021.01.10
[백준] 9070  (0) 2021.01.10
[백준] 8958  (0) 2021.01.10
[백준] 7600  (0) 2021.01.10
[백준] 7572  (0) 2021.01.10

댓글