s=eval(input())

t=eval(input())

ans = 10**9

for i in range(len(s)):

    # print('---',i)

    val = 0

    for j in range(len(t)):

        if i+j >= len(s):

            break

        si = s[i+j]

        ti = t[j]

        # print(si,ti)

        if si != ti:  val += 1

    else:

        ans = min(ans,val)



print(ans)
s=eval(input())

t=eval(input())

n = len(s)

ans = 10**9

for i in range(n):

    v = 0

    for j in range(len(t)):

        if j+i >= n: break

        if s[j+i] != t[j]: v+=1

    else:

        ans = min(ans,v)



print(ans)
s = eval(input())
t = eval(input())
ans = 10**9
for i in range(len(s)):
    # print('---',i)
    val = 0
    for j in range(len(t)):
        if i + j >= len(s):
            break
        si = s[i + j]
        ti = t[j]
        # print(si,ti)
        if si != ti:
            val += 1
    else:
        ans = min(ans, val)
print(ans)

s = eval(input())
t = eval(input())
n = len(s)
ans = 10**9
for i in range(n):
    v = 0
    for j in range(len(t)):
        if j + i >= n:
            break
        if s[j + i] != t[j]:
            v += 1
    else:
        ans = min(ans, v)
print(ans)

+n = len(s) -for i in range(len(s)): -    val = 0 +for i in range(n): +    v = 0 -        if i + j >= len(s): +        if j + i >= n: -        si = s[i + j] -        ti = t[j] -        # print(si,ti) -        if si != ti: -            val += 1 +        if s[j + i] != t[j]: +            v += 1 -        ans = min(ans, val) +        ans = min(ans, v)