s = eval(input())

t = eval(input())



cnt = []

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

    cnt1 = 0

    for k in range(len(t)):

        if t[k] == s[i: i + len(t)][k]:

            cnt1 += 1

            cnt.append(cnt1)

            #print(t[i:k], s[i:], k-i)

    else:

        cnt.append(0)

            #print(t[i:k], k - i)

#print(cnt)

print((len(t) - max(cnt)))

s = eval(input())

t = eval(input())



cnt = []

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

    cnt1 = 0

    for k in range(len(t)):

        if t[k] == s[i: i + len(t)][k]:

            cnt1 += 1

            cnt.append(cnt1)

            #print(t[i:k], s[i:], k-i)

        else:

            cnt.append(0)

            #print(t[i:k], k - i)

#print(cnt)

print((len(t) - max(cnt)))

s = eval(input())
t = eval(input())
cnt = []
for i in range(len(s) - len(t) + 1):
    cnt1 = 0
    for k in range(len(t)):
        if t[k] == s[i : i + len(t)][k]:
            cnt1 += 1
            cnt.append(cnt1)
            # print(t[i:k], s[i:], k-i)
    else:
        cnt.append(0)
        # print(t[i:k], k - i)
# print(cnt)
print((len(t) - max(cnt)))

s = eval(input())
t = eval(input())
cnt = []
for i in range(len(s) - len(t) + 1):
    cnt1 = 0
    for k in range(len(t)):
        if t[k] == s[i : i + len(t)][k]:
            cnt1 += 1
            cnt.append(cnt1)
            # print(t[i:k], s[i:], k-i)
        else:
            cnt.append(0)
            # print(t[i:k], k - i)
# print(cnt)
print((len(t) - max(cnt)))

-    else: -        cnt.append(0) -        # print(t[i:k], k - i) +        else: +            cnt.append(0) +            # print(t[i:k], k - i)