s = eval(input())

t = eval(input())

n = len(s)

m = len(t)

ans = m

for i in range(n-m+1):

    x = m

    for j in range(m):

        if s[i+j] == t[j]:

            x -= 1

    ans = min(ans,x)

print(ans)
s = eval(input())

t = eval(input())

n = len(s)

m = len(t)

ans = m

for i in range(n-m+1):

    p = 0

    for j in range(m):

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

            p += 1

    ans = min(ans,p)

print(ans)
s = eval(input())
t = eval(input())
n = len(s)
m = len(t)
ans = m
for i in range(n - m + 1):
    x = m
    for j in range(m):
        if s[i + j] == t[j]:
            x -= 1
    ans = min(ans, x)
print(ans)

s = eval(input())
t = eval(input())
n = len(s)
m = len(t)
ans = m
for i in range(n - m + 1):
    p = 0
    for j in range(m):
        if s[i + j] != t[j]:
            p += 1
    ans = min(ans, p)
print(ans)

-    x = m +    p = 0 -        if s[i + j] == t[j]: -            x -= 1 -    ans = min(ans, x) +        if s[i + j] != t[j]: +            p += 1 +    ans = min(ans, p)