import sys
import string
S = sys.stdin.readline().lower()
alpha_ls = string.ascii_lowercase
alpha_ct = []
for i in alpha_ls:
count = 0
for j in S:
if i == j:
count += 1
alpha_ct.append(count)
max_ls = [i for i in alpha_ct if i == max(alpha_ct)]
if len(max_ls) == 1:
print(alpha_ls[alpha_ct.index(max(alpha_ct))].upper())
else :
print('?')
words = input().upper()
unique_words = list(set(words)) # ์
๋ ฅ๋ฐ์ ๋ฌธ์์ด์์ ์ค๋ณต๊ฐ์ ์ ๊ฑฐ
cnt_list = []
for x in unique_words :
cnt = words.count(x)
cnt_list.append(cnt) # count ์ซ์๋ฅผ ๋ฆฌ์คํธ์ append
if cnt_list.count(max(cnt_list)) > 1 : # count ์ซ์ ์ต๋๊ฐ์ด ์ค๋ณต๋๋ฉด
print('?')
else :
max_index = cnt_list.index(max(cnt_list)) # count ์ซ์ ์ต๋๊ฐ ์ธ๋ฑ์ค(์์น)
print(unique_words[max_index])
์ด๊ฑด ๋ค๋ฅธ ํ์ด..!
๋ค๋ฅธ ํ์ด ์ถ์ฒ
'๐ Python > ๋ฐฑ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[2941]ํฌ๋ก์ํฐ์ ์ํ๋ฒณ (0) | 2022.03.12 |
---|---|
[5622]๋ค์ด์ผ (0) | 2022.03.12 |
[10809]์ํ๋ฒณ ์ฐพ๊ธฐ (0) | 2022.03.08 |
[11720]์ซ์์ ํฉ (0) | 2022.03.08 |
[4673]์ ํ ๋๋ฒ (0) | 2022.03.07 |