S = input().strip()

T = input().strip()

k = len(T)

dmin = len(S)

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

    cnt = 0

    for j in range(k):

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

            cnt += 1

    dmin = min(dmin,cnt)

print(dmin)
S = input().strip()

N = len(S)

T = input().strip()

k = len(T)

cmin = N

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

    cnt = 0

    for j in range(k):

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

            cnt += 1

    cmin = min(cmin,cnt)

print(cmin)
S = input().strip()
T = input().strip()
k = len(T)
dmin = len(S)
for i in range(len(S) - k + 1):
    cnt = 0
    for j in range(k):
        if S[i + j] != T[j]:
            cnt += 1
    dmin = min(dmin, cnt)
print(dmin)

S = input().strip()
N = len(S)
T = input().strip()
k = len(T)
cmin = N
for i in range(N - k + 1):
    cnt = 0
    for j in range(k):
        if S[i + j] != T[j]:
            cnt += 1
    cmin = min(cmin, cnt)
print(cmin)

+N = len(S) -dmin = len(S) -for i in range(len(S) - k + 1): +cmin = N +for i in range(N - k + 1): -    dmin = min(dmin, cnt) -print(dmin) +    cmin = min(cmin, cnt) +print(cmin)