algorithm (2) 썸네일형 리스트형 [BOJ] 여행가자 - 1976 Python import sys input = sys.stdin.readline print = sys.stdout.write def getParent(parent, x): if x == parent[x]: return x parent[x] = getParent(parent,parent[x]) return parent[x] def union(parent, x, y): x = getParent(parent, x) y = getParent(parent, y) if x < y : parent[y] = x else: parent[x] = y city = int(input()) testcase = int(input()) parent = [int(i) for i in range(city + 1)] now_city = 1 for .. [BOJ] 1157 - python def a(text): li = [] text = text.upper() text_dict = {} for i in text: if i in text_dict: text_dict[i] += 1 else: text_dict[i] = 1 text_dict = sorted(text_dict.items(), key=lambda x:x[1], reverse=True) if len(text_dict) == 1 : print(text_dict[0][0]) elif text_dict[0][1] == text_dict[1][1] : print("?") else: print(text_dict[0][0]) text = input() a(text) 이전 1 다음