s = eval(input())

t = eval(input())



fans = 100000000

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

    ans = 0

    for j in range(len(t)):

        if (s[i+j] == t[j]):

            pass

        else:

            ans += 1

    fans = min(fans, ans)



print(fans)
s=eval(input())

t=eval(input())

lent=len(t)

num=lent

ls=[]

count=0



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

  st=s[i:i+num]

  num+=1

  

  for j in range(lent):

    if st[j]!=t[j]:

      count+=1

      

  ls.append(count)

  count=0

  

print((min(ls)))
s = eval(input())
t = eval(input())
fans = 100000000
for i in range(len(s) - len(t) + 1):
    ans = 0
    for j in range(len(t)):
        if s[i + j] == t[j]:
            pass
        else:
            ans += 1
    fans = min(fans, ans)
print(fans)

s = eval(input())
t = eval(input())
lent = len(t)
num = lent
ls = []
count = 0
for i in range(len(s) - lent + 1):
    st = s[i : i + num]
    num += 1
    for j in range(lent):
        if st[j] != t[j]:
            count += 1
    ls.append(count)
    count = 0
print((min(ls)))

-fans = 100000000 -for i in range(len(s) - len(t) + 1): -    ans = 0 -    for j in range(len(t)): -        if s[i + j] == t[j]: -            pass -        else: -            ans += 1 -    fans = min(fans, ans) -print(fans) +lent = len(t) +num = lent +ls = [] +count = 0 +for i in range(len(s) - lent + 1): +    st = s[i : i + num] +    num += 1 +    for j in range(lent): +        if st[j] != t[j]: +            count += 1 +    ls.append(count) +    count = 0 +print((min(ls)))