BOJ - 2810 - 컵홀더

Updated:

def solution():
    N = int(input())
    Seat = str(input())
    data = ['*']
    flag = False
    for i in range(N):

        if Seat[i] == 'S':
            data.append(Seat[i])
            data.append('*')
        else:
            if flag:
                data.append(Seat[i])
                data.append('*')
                flag = False
            else:
                data.append(Seat[i])
                flag = True

    if data.count('*') < N: print(data.count('*'))
    else: print(N)

solution()

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

Categories:

Updated:

Leave a comment