S = eval(input())

T = eval(input())



# S = "cabacc"

# T = "abc"



lt = len(T)



def diff(s1, s2):

    d = len(s1)



    d -= len([i for i,j in zip(s1, s2) if i == j])

    return d



dlen = 1000000000

for i in range(len(S)):

    if i + lt <= len(S):

        dlen = min(dlen, diff(T, S[i:i+lt]))



print(dlen)

S = eval(input())

T = eval(input())



lt, ls = len(T), len(S)



def diff(s1, s2):

    d = len(s1)



    d -= len([i for i,j in zip(s1, s2) if i == j])

    return d



dlen = min([diff(T, S[i:i+lt]) for i in range(ls) if i + lt <= ls])



print(dlen)

S = eval(input())
T = eval(input())
# S = "cabacc"
# T = "abc"
lt = len(T)


def diff(s1, s2):
    d = len(s1)
    d -= len([i for i, j in zip(s1, s2) if i == j])
    return d


dlen = 1000000000
for i in range(len(S)):
    if i + lt <= len(S):
        dlen = min(dlen, diff(T, S[i : i + lt]))
print(dlen)

S = eval(input())
T = eval(input())
lt, ls = len(T), len(S)


def diff(s1, s2):
    d = len(s1)
    d -= len([i for i, j in zip(s1, s2) if i == j])
    return d


dlen = min([diff(T, S[i : i + lt]) for i in range(ls) if i + lt <= ls])
print(dlen)

-# S = "cabacc" -# T = "abc" -lt = len(T) +lt, ls = len(T), len(S) -dlen = 1000000000 -for i in range(len(S)): -    if i + lt <= len(S): -        dlen = min(dlen, diff(T, S[i : i + lt])) +dlen = min([diff(T, S[i : i + lt]) for i in range(ls) if i + lt <= ls])