s, t = eval(input()), eval(input())





def d(s, t):

    cnt = 0

    for i in range(len(s)):

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

            cnt += 1

    return cnt





n = len(s)

m = len(t)

ans = 1000000

for i in range(n - m + 1):

    ans = min(ans, d(s[i:i + m], t))

print(ans)

def d(s, t):

    cnt = 0

    for i in range(len(s)):

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

            cnt += 1

    return cnt





s, t = eval(input()), eval(input())

n = len(s)

m = len(t)

ans = 1000000

print((min(d(s[i:i + m], t) for i in range(n - m + 1))))

s, t = eval(input()), eval(input())


def d(s, t):
    cnt = 0
    for i in range(len(s)):
        if s[i] != t[i]:
            cnt += 1
    return cnt


n = len(s)
m = len(t)
ans = 1000000
for i in range(n - m + 1):
    ans = min(ans, d(s[i : i + m], t))
print(ans)

def d(s, t):
    cnt = 0
    for i in range(len(s)):
        if s[i] != t[i]:
            cnt += 1
    return cnt


s, t = eval(input()), eval(input())
n = len(s)
m = len(t)
ans = 1000000
print((min(d(s[i : i + m], t) for i in range(n - m + 1))))

-s, t = eval(input()), eval(input()) - - +s, t = eval(input()), eval(input()) -for i in range(n - m + 1): -    ans = min(ans, d(s[i : i + m], t)) -print(ans) +print((min(d(s[i : i + m], t) for i in range(n - m + 1))))