S = list(eval(input()))

T = list(eval(input()))



lst_of_values = []

for i in range(len(S)):

    current = 0

    if i + len(T) > len(S):

        break



    k = 0

    for j in range(i, i+len(T)):

        if S[j] != T[k]:

            current += 1

        k+=1

    lst_of_values.append(current)

    k=0



print((min(lst_of_values)))



S = eval(input())

T = eval(input())



counter = 0

for i in range(len(S)):

    second = 0

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

    if len(group) < len(T):

        break

    for j in range(len(T)):

        if T[j] != group[j]:

            second += 1

    if counter == 0:

        counter = second

    elif second < counter:

        counter = second





print(counter)
S = list(eval(input()))
T = list(eval(input()))
lst_of_values = []
for i in range(len(S)):
    current = 0
    if i + len(T) > len(S):
        break
    k = 0
    for j in range(i, i + len(T)):
        if S[j] != T[k]:
            current += 1
        k += 1
    lst_of_values.append(current)
    k = 0
print((min(lst_of_values)))

S = eval(input())
T = eval(input())
counter = 0
for i in range(len(S)):
    second = 0
    group = S[i : i + len(T)]
    if len(group) < len(T):
        break
    for j in range(len(T)):
        if T[j] != group[j]:
            second += 1
    if counter == 0:
        counter = second
    elif second < counter:
        counter = second
print(counter)

-S = list(eval(input())) -T = list(eval(input())) -lst_of_values = [] +S = eval(input()) +T = eval(input()) +counter = 0 -    current = 0 -    if i + len(T) > len(S): +    second = 0 +    group = S[i : i + len(T)] +    if len(group) < len(T): -    k = 0 -    for j in range(i, i + len(T)): -        if S[j] != T[k]: -            current += 1 -        k += 1 -    lst_of_values.append(current) -    k = 0 -print((min(lst_of_values))) +    for j in range(len(T)): +        if T[j] != group[j]: +            second += 1 +    if counter == 0: +        counter = second +    elif second < counter: +        counter = second +print(counter)