본문 바로가기
python-algorithm

백준 17094 Serious Problem

by 무적김두칠 2022. 12. 26.

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

 

17094번: Serious Problem

2의 등장횟수가 더 많다면 2를 출력하고, e의 등장횟수가 더 많다면 e를 출력한다. 등장횟수가 같다면 "yee"를 출력한다. (큰 따옴표 제외)

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
12
13
def sol(s):
    if s.count('2')>s.count('e'):
        return 2
    elif s.count('2')<s.count('e'):
        return 'e'
    elif s.count('2')==s.count('e'):
        return 'yee'
 
if __name__ == '__main__':
    n = int(input())
    s = input()
    print(sol(s))
    
cs
반응형

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

백준 16428 A/B - 3  (0) 2022.12.28
백준 4806 줄 세기  (0) 2022.12.26
백준 17010 Time to Decompress  (0) 2022.12.26
백준 18883 N M 찍기  (0) 2022.12.26
백준 5354 J박스  (0) 2022.12.26

댓글