[백준 2810] 컵홀더.py

🐥·2022년 1월 10일
0

백준

목록 보기
7/18


문제 이해하기

⦁ 사람이 많나? 컵홀더가 많나?

핵심

손으로 직접해보니 커플좌석(LL)이 들어가면 최대 사람 수가 1씩 증가하는 것을 알 수 있다.

소스코드

num = int(input())
seat = input()
holder = 0
if (seat.find('LL') != -1):  # seat에 'LL'이 포함되있는지 확인
    holder = 1
seat = seat.replace('LL', 'S')

holder += seat.count('S')
print(holder)
profile
열심히 공부하자!!

0개의 댓글