Algorithm
2023. 11. 26.
[파이썬] 백준 1157번: 단어 공부
https://www.acmicpc.net/problem/1157 1157번: 단어 공부 알파벳 대소문자로 된 단어가 주어지면, 이 단어에서 가장 많이 사용된 알파벳이 무엇인지 알아내는 프로그램을 작성하시오. 단, 대문자와 소문자를 구분하지 않는다. www.acmicpc.net from collections import Counter def solution(s): s = s.upper() common = Counter(s).most_common(2) if len(common) == 2 and common[0][1] == common[1][1]: return '?' else: return common[0][0] print(solution(input())) 1. 먼저 단어 s를 대문자로 바꿔주고, Count..