S = eval(input())

T = eval(input())



ans = 0

for i in range(len(S)-len(T)+1):

    tmp = 0

    pos = i

    for j in range(len(T)):

        if pos < len(S):

            if S[pos] == T[j]:

                tmp += 1

        pos += 1

    ans = max(tmp, ans)



print((len(T)-ans))
S = eval(input())

T = eval(input())



ans = len(S)



for i in range(len(S)-len(T)+1):

    tmp = 0

    for j in range(len(T)):

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

            tmp += 1

    ans = min(ans, tmp)



print(ans)
S = eval(input())
T = eval(input())
ans = 0
for i in range(len(S) - len(T) + 1):
    tmp = 0
    pos = i
    for j in range(len(T)):
        if pos < len(S):
            if S[pos] == T[j]:
                tmp += 1
        pos += 1
    ans = max(tmp, ans)
print((len(T) - ans))

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

-ans = 0 +ans = len(S) -    pos = i -        if pos < len(S): -            if S[pos] == T[j]: -                tmp += 1 -        pos += 1 -    ans = max(tmp, ans) -print((len(T) - ans)) +        if S[i + j] != T[j]: +            tmp += 1 +    ans = min(ans, tmp) +print(ans)