s = eval(input())

t = eval(input())

ls = []

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

    ls.append(s[i:i+len(t)])

now = 0

minimum = len(t)

for i in range(len(ls)):

    now = 0

    for j in range(len(t)):

        if t[j] == ls[i][j]:

            now += 1

    if len(t) - now < minimum:

        minimum = len(t) - now

print(minimum)
S = eval(input())

T = eval(input())

A = len(T)  

ls = []

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

    ls.append(S[i:i+len(T)])

for i in range(len(ls)):

    same = 0

    for j in range(len(T)):

        if T[j] == ls[i][j]:

            same += 1;

        if len(T)-same < A:

            A = len(T)-same

print(A)
s = eval(input())
t = eval(input())
ls = []
for i in range(len(s) - len(t) + 1):
    ls.append(s[i : i + len(t)])
now = 0
minimum = len(t)
for i in range(len(ls)):
    now = 0
    for j in range(len(t)):
        if t[j] == ls[i][j]:
            now += 1
    if len(t) - now < minimum:
        minimum = len(t) - now
print(minimum)

S = eval(input())
T = eval(input())
A = len(T)
ls = []
for i in range(len(S) - len(T) + 1):
    ls.append(S[i : i + len(T)])
for i in range(len(ls)):
    same = 0
    for j in range(len(T)):
        if T[j] == ls[i][j]:
            same += 1
        if len(T) - same < A:
            A = len(T) - same
print(A)

-s = eval(input()) -t = eval(input()) +S = eval(input()) +T = eval(input()) +A = len(T) -for i in range(len(s) - len(t) + 1): -    ls.append(s[i : i + len(t)]) -now = 0 -minimum = len(t) +for i in range(len(S) - len(T) + 1): +    ls.append(S[i : i + len(T)]) -    now = 0 -    for j in range(len(t)): -        if t[j] == ls[i][j]: -            now += 1 -    if len(t) - now < minimum: -        minimum = len(t) - now -print(minimum) +    same = 0 +    for j in range(len(T)): +        if T[j] == ls[i][j]: +            same += 1 +        if len(T) - same < A: +            A = len(T) - same +print(A)