s = eval(input())

t = eval(input())

x = len(t)

y = len(s) - len(t) + 1

z = 0

for i in range(y):

    a = 0

    for j in range(x):

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

            a += 1

    z = max(z, a)



print((x - z))
s = eval(input())

t = eval(input())



S = len(s)

T = len(t)



x = len(t)

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

    y = 0

    for j in range(T):

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

            y += 1

    x = min(x, y)



print(x)
s = eval(input())
t = eval(input())
x = len(t)
y = len(s) - len(t) + 1
z = 0
for i in range(y):
    a = 0
    for j in range(x):
        if s[i + j] == t[j]:
            a += 1
    z = max(z, a)
print((x - z))

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

+S = len(s) +T = len(t) -y = len(s) - len(t) + 1 -z = 0 -for i in range(y): -    a = 0 -    for j in range(x): -        if s[i + j] == t[j]: -            a += 1 -    z = max(z, a) -print((x - z)) +for i in range(S - T + 1): +    y = 0 +    for j in range(T): +        if t[j] != s[i + j]: +            y += 1 +    x = min(x, y) +print(x)