s = eval(input())

t = eval(input())



stri = []

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

    j = i+ len(t)

    stri.append(s[i:j])

maxcount = 0

for i in range(len(stri)):

    count = 0

    for j in range(len(t)):

        if(stri[i][j] ==t[j]):

            count+= 1

    maxcount = max(maxcount,count) 

print((len(t)-maxcount))
s = eval(input())

t = eval(input())



stri = []

mincount = 1e9

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

    count = 0

    for j in range(len(t)):

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

            count+= 1

    mincount = min(mincount,count) 

print(mincount)
s = eval(input())
t = eval(input())
stri = []
for i in range(len(s) - len(t) + 1):
    j = i + len(t)
    stri.append(s[i:j])
maxcount = 0
for i in range(len(stri)):
    count = 0
    for j in range(len(t)):
        if stri[i][j] == t[j]:
            count += 1
    maxcount = max(maxcount, count)
print((len(t) - maxcount))

s = eval(input())
t = eval(input())
stri = []
mincount = 1e9
for i in range(len(s) - len(t) + 1):
    count = 0
    for j in range(len(t)):
        if s[i + j] != t[j]:
            count += 1
    mincount = min(mincount, count)
print(mincount)

+mincount = 1e9 -    j = i + len(t) -    stri.append(s[i:j]) -maxcount = 0 -for i in range(len(stri)): -        if stri[i][j] == t[j]: +        if s[i + j] != t[j]: -    maxcount = max(maxcount, count) -print((len(t) - maxcount)) +    mincount = min(mincount, count) +print(mincount)