1seul357
[SWEA] 가장 빠른 문자열 타이핑 본문
T = int(input())
for TC in range(T):
str1, str2 = map(str, input().split())
N = len(str1)
M = len(str2)
index = 0
count = 0
while index <= N-M+1:
if str1[index:index+M] == str2:
count += 1
index += M
else:
count += 1
index += 1
if index != N:
for i in range(index, N):
count += 1
print('#{} {}'.format(TC+1, count))
'알고리즘 > SWEA' 카테고리의 다른 글
[SWEA] 마그네틱 (0) | 2021.12.02 |
---|---|
[SWEA] 퍼펙트 셔플 (0) | 2021.12.02 |
[SWEA] 앞글자 따기 (0) | 2021.12.02 |
[SWEA] String (0) | 2021.12.02 |
[SWEA] Sum (0) | 2021.12.02 |