Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Archives
Today
Total
관리 메뉴

자르비 왕국

[백준] 1157 단어 공부 - Python 본문

문제풀이

[백준] 1157 단어 공부 - Python

자르비옹스 2022. 1. 16. 18:38

https://www.acmicpc.net/problem/1157

 

1157번: 단어 공부

알파벳 대소문자로 된 단어가 주어지면, 이 단어에서 가장 많이 사용된 알파벳이 무엇인지 알아내는 프로그램을 작성하시오. 단, 대문자와 소문자를 구분하지 않는다.

www.acmicpc.net

풀이

from collections import Counter

word = input().upper()
preq = Counter(word).most_common()

if(len(preq) >= 2 and preq[0][1] == preq[1][1]) :
    print('?')
else :
    print(preq[0][0])

'문제풀이' 카테고리의 다른 글

[백준] 11286 절댓값 힙 - Python  (0) 2022.01.16
[백준] 11279 최대 힙  (0) 2022.01.16
[백준] 2592 대표값 - Python  (0) 2022.01.16
[백준] 15650 N과 M(2) - Python  (0) 2022.01.16
[백준] 10825 국영수 - Python  (0) 2022.01.13