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,t=eval(input()),eval(input())

print((min(sum(c!=d for c,d in zip(s[i:],t)) for i in range(len(s)-len(t)+1))))
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, t = eval(input()), eval(input())
print((min(sum(c != d for c, d in zip(s[i:], t)) for i in range(len(s) - len(t) + 1))))

-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)))) +print((min(sum(c != d for c, d in zip(s[i:], t)) for i in range(len(s) - len(t) + 1))))