s = eval(input())

t = eval(input())



INF = 10**9

min_ans = INF

for i in range(len(s)-len(t)+1):

    c = 0

    for j in range(len(t)):

        si = s[i+j]

        ti = t[j]

        # print(i,j,si,ti)

        if si == ti:

            c += 1

    min_ans = min(min_ans, len(t)-c)

print(min_ans)

s = eval(input())

t = eval(input())

ans = 10**9

for i in range(len(s)-len(t)+1):

    c = 0

    for j in range(len(t)):

        if s[i+j] != t[j]: c += 1

    ans = min(ans, c)

print(ans)

s = eval(input())
t = eval(input())
INF = 10**9
min_ans = INF
for i in range(len(s) - len(t) + 1):
    c = 0
    for j in range(len(t)):
        si = s[i + j]
        ti = t[j]
        # print(i,j,si,ti)
        if si == ti:
            c += 1
    min_ans = min(min_ans, len(t) - c)
print(min_ans)

s = eval(input())
t = eval(input())
ans = 10**9
for i in range(len(s) - len(t) + 1):
    c = 0
    for j in range(len(t)):
        if s[i + j] != t[j]:
            c += 1
    ans = min(ans, c)
print(ans)

-INF = 10**9 -min_ans = INF +ans = 10**9 -        si = s[i + j] -        ti = t[j] -        # print(i,j,si,ti) -        if si == ti: +        if s[i + j] != t[j]: -    min_ans = min(min_ans, len(t) - c) -print(min_ans) +    ans = min(ans, c) +print(ans)