count = int(input())
vote = input()
count_A = 0
count_B = 0
for i in range(len(vote)):
if(vote[i] == "A" ):
count_A += 1
elif vote[i] == "B":
count_B += 1
if(count_A > count_B):
print("A")
elif count_A <count_B:
print("B")
else:
print("Tie")
Python
복사
V = int(input())
vote = list(str(input()))
A = B = 0
for v in vote:
if v == 'A':
A += 1
else:
B += 1
if A > B:
print('A')
elif A == B:
print('Tie')
else:
print('B')
Python
복사
리스트 사용하는 방법도 있음..