S = eval(input())

T = eval(input())



res = 0

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

    res = max(res, tmp)



print((len(T) - res))

S = eval(input())

T = eval(input())



if len(S) == 1:

    if S == T:

        print((0))

    else:

        print((1))



else:

    l = []

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

        A = S[i:i + (len(T))]

        # print(A)

        count = 0

        for j in range(len(A)):

            if A[j] == T[j]:

                count += 1

                # print(count)

        l.append(count)



    # print(l)

    if len(l) > 0:

        a = len(T) - max(l)

        print(a)

    else:

        a = 1

        print(a)

S = eval(input())
T = eval(input())
res = 0
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
    res = max(res, tmp)
print((len(T) - res))

S = eval(input())
T = eval(input())
if len(S) == 1:
    if S == T:
        print((0))
    else:
        print((1))
else:
    l = []
    for i in range(len(S) - len(T) + 1):
        A = S[i : i + (len(T))]
        # print(A)
        count = 0
        for j in range(len(A)):
            if A[j] == T[j]:
                count += 1
                # print(count)
        l.append(count)
    # print(l)
    if len(l) > 0:
        a = len(T) - max(l)
        print(a)
    else:
        a = 1
        print(a)

-res = 0 -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 -    res = max(res, tmp) -print((len(T) - res)) +if len(S) == 1: +    if S == T: +        print((0)) +    else: +        print((1)) +else: +    l = [] +    for i in range(len(S) - len(T) + 1): +        A = S[i : i + (len(T))] +        # print(A) +        count = 0 +        for j in range(len(A)): +            if A[j] == T[j]: +                count += 1 +                # print(count) +        l.append(count) +    # print(l) +    if len(l) > 0: +        a = len(T) - max(l) +        print(a) +    else: +        a = 1 +        print(a)