-
[1120] 문자열 (Python)[Python] 알고리즘/Silver 2021. 11. 21. 15:06
[문제]
https://www.acmicpc.net/problem/1120
알고리즘 분류는 구현, 문자열, 브루트포스 알고리즘 입니다.
문자를 직접 붙이는 것이 아닌, 한 자리씩 밀며 검사하는 것입니다.
[코드]
import sys A, B = sys.stdin.readline().split() res = list() for i in range(len(B) - len(A) + 1): cnt = 0 for j in range(len(A)): if A[j] != B[j + i]: cnt += 1 res.append(cnt) print(min(res))
'[Python] 알고리즘 > Silver' 카테고리의 다른 글
[14495] 피보나치 비스무리한 수열 (Python) (0) 2021.11.23 [11508] 2+1 세일 (Python) (0) 2021.11.22 [2312] 수 복원하기 (Python) (0) 2021.11.20 [1713] 후보 추천하기 (Python) (0) 2021.11.19 [1850] 최대공약수 (Python) (0) 2021.11.18