S = eval(input())

T = eval(input())

cnt = len(S)-len(T)+1

res = []

for i in range(cnt):

    res2 = 0

    for j in range(len(T)):

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

            res2 += 1

    res.append(res2)

print((min(res))) 
S = eval(input())

T = eval(input())

cnt = []

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

    cnt2 = 0

    for j in range(len(T)):

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

            cnt2 += 1

    cnt.append(cnt2)

print((min(cnt)))

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

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

-cnt = len(S) - len(T) + 1 -res = [] -for i in range(cnt): -    res2 = 0 +cnt = [] +for i in range(len(S) - len(T) + 1): +    cnt2 = 0 -            res2 += 1 -    res.append(res2) -print((min(res))) +            cnt2 += 1 +    cnt.append(cnt2) +print((min(cnt)))