We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8f2cf3f commit 1dfb830Copy full SHA for 1dfb830
Hongjoo/백준/문자열교환.py
@@ -0,0 +1,15 @@
1
+"""
2
+https://www.acmicpc.net/problem/1522
3
4
+
5
+words= input()
6
+window_size = words.count("a") # 1. a의 개수 = sliding window 크기
7
+result = 999999999
8
9
+# 원형 문자열
10
+words += words[0:window_size-1]
11
+# 2. 최대한 a 가 연속해 있는 idx 범위 찾기
12
+for start in range(len(words) - (window_size-1)):
13
+ result = min(result, words[start: start+ window_size].count("b"))
14
15
+print(result)
0 commit comments