s = eval(input())

t = eval(input())

l = len(t)

ls = len(s)

ans = 0



for i in range(ls-l+1):

    num = 0

    for j in range(l):

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

            num += 1

    ans = max(ans, num)



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

t = eval(input())

lt = len(t)

ls = len(s)

ans = ls



for i in range(ls-lt+1):

    num = 0

    for j in range(lt):

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

            num += 1

    ans = min(ans, num)



print(ans)
s = eval(input())
t = eval(input())
l = len(t)
ls = len(s)
ans = 0
for i in range(ls - l + 1):
    num = 0
    for j in range(l):
        if s[i + j] == t[j]:
            num += 1
    ans = max(ans, num)
print((l - ans))

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

-l = len(t) +lt = len(t) -ans = 0 -for i in range(ls - l + 1): +ans = ls +for i in range(ls - lt + 1): -    for j in range(l): -        if s[i + j] == t[j]: +    for j in range(lt): +        if s[i + j] != t[j]: -    ans = max(ans, num) -print((l - ans)) +    ans = min(ans, num) +print(ans)