python-algorithm

백준 17094 Serious Problem

무적김두칠 2022. 12. 26. 20:16

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
반응형