S =eval(input())

T =eval(input())

mint=10000



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

    con = 0

    for j in range(len(T)):

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

            con += 1

            

    mint =min(con,mint)

    

    if mint == 0:

        break





print(mint)

s = eval(input())

t = eval(input())

mini =10000000



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

    count = 0

    for z in range(len(t)):

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

            count += 1

            

    if count < mini :

            mini = count



print(mini) 
S = eval(input())
T = eval(input())
mint = 10000
for i in range(len(S) - len(T) + 1):
    con = 0
    for j in range(len(T)):
        if S[i + j] != T[j]:
            con += 1
    mint = min(con, mint)
    if mint == 0:
        break
print(mint)

s = eval(input())
t = eval(input())
mini = 10000000
for i in range(len(s) - len(t) + 1):
    count = 0
    for z in range(len(t)):
        if s[i + z] != t[z]:
            count += 1
    if count < mini:
        mini = count
print(mini)

-S = eval(input()) -T = eval(input()) -mint = 10000 -for i in range(len(S) - len(T) + 1): -    con = 0 -    for j in range(len(T)): -        if S[i + j] != T[j]: -            con += 1 -    mint = min(con, mint) -    if mint == 0: -        break -print(mint) +s = eval(input()) +t = eval(input()) +mini = 10000000 +for i in range(len(s) - len(t) + 1): +    count = 0 +    for z in range(len(t)): +        if s[i + z] != t[z]: +            count += 1 +    if count < mini: +        mini = count +print(mini)