s=eval(input())

t=eval(input())



m,n=len(s),len(t)



ans=1000

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

    k=0

    for j in range(n):

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

             k+=1

    ans=min(ans,k)



print(ans)

s=eval(input())

t=eval(input())



m=len(s)

n=len(t)



ans=1000

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

    k=0

    for j in range(n):

        k+=s[i+j]!=t[j]

    ans=min(ans,k)



print(ans)

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

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

-m, n = len(s), len(t) +m = len(s) +n = len(t) -        if s[i + j] != t[j]: -            k += 1 +        k += s[i + j] != t[j]