Skip to content

Commit

Permalink
solve : 20365 블로그2
Browse files Browse the repository at this point in the history
  • Loading branch information
wwan13 committed May 14, 2024
1 parent f41f8fb commit 7093f02
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions python/boj_20365.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import sys

input = sys.stdin.readline


def solution(n, data):
colors = {"R": 0, "B": 0}
colors[data[0]] += 1

for i in range(1, n):
if data[i] != data[i-1]:
colors[data[i]] += 1

return min(colors["R"], colors["B"]) + 1


def display_result(answer):
print(answer)


def main():
n = int(input())
data = list(map(str, input().rstrip()))
answer = solution(n, data)
display_result(answer)


main()

0 comments on commit 7093f02

Please sign in to comment.