Skip to content

Commit 09428e6

Browse files
committed
[BOJ]문자열교환/ Silver / 30min
https://www.acmicpc.net/problem/1522
1 parent 7a3e2c3 commit 09428e6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Hongjoo/백준/문자열교환.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
words= input()
66
window_size = words.count("a") # 1. a의 개수 = sliding window 크기
7-
result = 999999999
7+
result = 99999999
88

99
# 원형 문자열
1010
words += words[0:window_size-1]
1111
# 2. 최대한 a 가 연속해 있는 idx 범위 찾기
1212
for start in range(len(words) - (window_size-1)):
1313
result = min(result, words[start: start+ window_size].count("b"))
1414

15-
print(result)
15+
print(result)
16+

0 commit comments

Comments
 (0)