S = eval(input())

T = eval(input())



max_count = 0

for start_t in range(len(T)):

    for start_s in range(start_t, len(S)):

        if len(S) - start_s < len(T) - start_t:

            break

        if T[start_t] == S[start_s]:

            count = 0



            for i in range(len(T) - start_t):

                if T[start_t+i] == S[start_s+i]:

                    count += 1

            

            max_count = max(max_count, count)



answer = len(T) - max_count

print(answer)



S = eval(input())

T = eval(input())



answer = float('inf')

for s in range(len(S)):

    if len(S) - s < len(T):

        break

    count = 0

    for i in range(len(T)):



        if S[s+i] != T[i]:

            count += 1



    answer = min(answer, count)



print(answer)
S = eval(input())
T = eval(input())
max_count = 0
for start_t in range(len(T)):
    for start_s in range(start_t, len(S)):
        if len(S) - start_s < len(T) - start_t:
            break
        if T[start_t] == S[start_s]:
            count = 0
            for i in range(len(T) - start_t):
                if T[start_t + i] == S[start_s + i]:
                    count += 1
            max_count = max(max_count, count)
answer = len(T) - max_count
print(answer)

S = eval(input())
T = eval(input())
answer = float("inf")
for s in range(len(S)):
    if len(S) - s < len(T):
        break
    count = 0
    for i in range(len(T)):
        if S[s + i] != T[i]:
            count += 1
    answer = min(answer, count)
print(answer)

-max_count = 0 -for start_t in range(len(T)): -    for start_s in range(start_t, len(S)): -        if len(S) - start_s < len(T) - start_t: -            break -        if T[start_t] == S[start_s]: -            count = 0 -            for i in range(len(T) - start_t): -                if T[start_t + i] == S[start_s + i]: -                    count += 1 -            max_count = max(max_count, count) -answer = len(T) - max_count +answer = float("inf") +for s in range(len(S)): +    if len(S) - s < len(T): +        break +    count = 0 +    for i in range(len(T)): +        if S[s + i] != T[i]: +            count += 1 +    answer = min(answer, count)