S = eval(input())

T = eval(input())

Ls = len(S)

Lt = len(T)

ans = 0

for i in range(Ls-Lt+1):

    count = 0

    for j in range(Lt):

        count += S[i+j] == T[j]

    ans = max(ans, count)

ans = Lt-ans

print(ans)

S = eval(input())

T = eval(input())

Ls = len(S)

Lt = len(T)

ans = 1000

for i in range(Ls-Lt+1):

    count = 0

    for j in range(Lt):

        if S[i+j] != T[j]:

            count += 1

    ans = min(ans, count)

print(ans)

S = eval(input())
T = eval(input())
Ls = len(S)
Lt = len(T)
ans = 0
for i in range(Ls - Lt + 1):
    count = 0
    for j in range(Lt):
        count += S[i + j] == T[j]
    ans = max(ans, count)
ans = Lt - ans
print(ans)

S = eval(input())
T = eval(input())
Ls = len(S)
Lt = len(T)
ans = 1000
for i in range(Ls - Lt + 1):
    count = 0
    for j in range(Lt):
        if S[i + j] != T[j]:
            count += 1
    ans = min(ans, count)
print(ans)

-ans = 0 +ans = 1000 -        count += S[i + j] == T[j] -    ans = max(ans, count) -ans = Lt - ans +        if S[i + j] != T[j]: +            count += 1 +    ans = min(ans, count)