S = eval(input())

T = eval(input())



ans = len(T)

for i in range(len(S)-len(T)+1):

    cnt = 0

    for j in range(len(T)):

        if T[j] != S[i:i+len(T)][j]:

            cnt += 1

    ans = min(ans, cnt)



print(ans)

S = eval(input())

T = eval(input())



N = len(S)

M = len(T)

ans = M

for i in range(N-M+1):

    cnt = 0

    for j in range(M):

        if T[j] != S[i:i+M][j]:

            cnt += 1

    ans = min(ans, cnt)



print(ans)

S = eval(input())
T = eval(input())
ans = len(T)
for i in range(len(S) - len(T) + 1):
    cnt = 0
    for j in range(len(T)):
        if T[j] != S[i : i + len(T)][j]:
            cnt += 1
    ans = min(ans, cnt)
print(ans)

S = eval(input())
T = eval(input())
N = len(S)
M = len(T)
ans = M
for i in range(N - M + 1):
    cnt = 0
    for j in range(M):
        if T[j] != S[i : i + M][j]:
            cnt += 1
    ans = min(ans, cnt)
print(ans)

-ans = len(T) -for i in range(len(S) - len(T) + 1): +N = len(S) +M = len(T) +ans = M +for i in range(N - M + 1): -    for j in range(len(T)): -        if T[j] != S[i : i + len(T)][j]: +    for j in range(M): +        if T[j] != S[i : i + M][j]: