import sys

import math



#https://atcoder.jp/contests/agc008/submissions/15248942

sys.setrecursionlimit(10 ** 8)

ini = lambda: int(sys.stdin.readline())

inm = lambda: map(int, sys.stdin.readline().split())

inl = lambda: list(inm())

ins = lambda: sys.stdin.readline().rstrip()

debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))



S = input()

T = input()



ans = 0

for i in range(len(S)):

    for j in range(i+1,len(S)+1):

        if (j-i) == len(T):

            match = 0

            for k,l in enumerate(range(i,j)):

                if S[l] == T[k]:

                    match += 1

            ans = max(ans,match)



print(len(T)-ans)



import sys

import math



#https://atcoder.jp/contests/agc008/submissions/15248942

sys.setrecursionlimit(10 ** 8)

ini = lambda: int(sys.stdin.readline())

inm = lambda: map(int, sys.stdin.readline().split())

inl = lambda: list(inm())

ins = lambda: sys.stdin.readline().rstrip()

debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))



S = input()

T = input()

ans = 1e9



for si in range(len(S)):

    if si+len(T) > len(S):

        break

    cnt = 0

    for i in range(len(T)):

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

            cnt += 1

    ans = min(ans,cnt)



print(ans)

import sys
import math

# https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10**8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))
S = input()
T = input()
ans = 0
for i in range(len(S)):
    for j in range(i + 1, len(S) + 1):
        if (j - i) == len(T):
            match = 0
            for k, l in enumerate(range(i, j)):
                if S[l] == T[k]:
                    match += 1
            ans = max(ans, match)
print(len(T) - ans)

import sys
import math

# https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10**8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))
S = input()
T = input()
ans = 1e9
for si in range(len(S)):
    if si + len(T) > len(S):
        break
    cnt = 0
    for i in range(len(T)):
        if S[si + i] != T[i]:
            cnt += 1
    ans = min(ans, cnt)
print(ans)

-ans = 0 -for i in range(len(S)): -    for j in range(i + 1, len(S) + 1): -        if (j - i) == len(T): -            match = 0 -            for k, l in enumerate(range(i, j)): -                if S[l] == T[k]: -                    match += 1 -            ans = max(ans, match) -print(len(T) - ans) +ans = 1e9 +for si in range(len(S)): +    if si + len(T) > len(S): +        break +    cnt = 0 +    for i in range(len(T)): +        if S[si + i] != T[i]: +            cnt += 1 +    ans = min(ans, cnt) +print(ans)