s=eval(input())

t=eval(input())

a=0

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

  c=0

  for j,d in enumerate(t):

    if s[i+j]==d: c+=1

  a=max(a,c)

print((len(t)-a))
s,t=eval(input()),eval(input())

l=len(t)

print((l-max(sum(s[i+j]==t[j] for j in range(l)) for i in range(len(s)-l+1))))
s = eval(input())
t = eval(input())
a = 0
for i in range(len(s) - len(t) + 1):
    c = 0
    for j, d in enumerate(t):
        if s[i + j] == d:
            c += 1
    a = max(a, c)
print((len(t) - a))

s, t = eval(input()), eval(input())
l = len(t)
print((l - max(sum(s[i + j] == t[j] for j in range(l)) for i in range(len(s) - l + 1))))

-s = eval(input()) -t = eval(input()) -a = 0 -for i in range(len(s) - len(t) + 1): -    c = 0 -    for j, d in enumerate(t): -        if s[i + j] == d: -            c += 1 -    a = max(a, c) -print((len(t) - a)) +s, t = eval(input()), eval(input()) +l = len(t) +print((l - max(sum(s[i + j] == t[j] for j in range(l)) for i in range(len(s) - l + 1))))