peterverebics/CodeNet_Python_118 huggingface dataset:
S = input()
T = input()

max_match = 0

n = len(T)
m = len(S)

for i in range(m-n):
    tmp = 0
    for j in range(i,i+n):
        if S[j] == T[j-i]:
            tmp += 1
    if tmp > max_match:
        max_match = tmp

ans = n - max_match



print(ans)
s = input()
t = input()
ans = len(t)
len_t = len(t)
for i in range(len(s)-len(t)):
    cnt = len_t
    for j in range(len(t)):
        if s[i+j] == t[j]:
            cnt -= 1
    if ans > cnt:
        ans = cnt
print(ans)
s=input()
t=input()
ans=len(t)
for i in range(len(s)):
    s1=s[i:len(t)]
    sum=len(t)
    for j in range(len(s1)):
        if t[j]==s1[j]:sum-=1
    ans=min(ans,sum)
print(ans)
S = input()
T = input()

min_count = 10000000

for k in range(len(T)):
  for i in range(len(S)-len(T)+1):
    count = k
    if T[k] == S[k+i]:
      for j in range(1,len(T)-k):
        if S[i+j] != T[k+j]:
          count += 1
      if count < min_count:
        min_count = count
        
print(min_count)
def probB():
    S = input()
    T = input()

    if T in S:
        print(0)
        return

    maxequal = 0
    for i in range(len(S) - len(T)):
        count = 0
        for j in range(len(T)):
            if S[i + j] == T[j]:
                count += 1
            if (count > maxequal):
                maxequal = count
    print(len(T) - maxequal if maxequal > 0 else 0)

def main():
    probB()


if __name__ == '__main__':
    main()
S,T=open(0).read().split()
def main():
    for i in range(1,len(T)+1):
        for j in range(i+1):
            if T[j:(len(T)-i+j)] in S[j:(len(S)-i+j)]:
                return i
                break
if T in S:
    print(0)
else:
    print(main())
# from math import 

s = input()
t = input()

def distance(s, t):
    assert(len(s) == len(t))
    return len(s) - sum([c1 == c2 for c1, c2 in zip(s, t)])


min_d = len(s)

for i in range(len(s) - len(t)):
    min_d = min(min_d, distance(s[i:i+len(t)], t))

print(min_d)
S = input()
T = input()

len_T = len(T)
len_S = len(S)
output = len_T

for i in range(len_S-len_T):
    diff = 0
    for j in range(len_T):
        if T[j] != S[i+j]:
            diff += 1
    output = min(output, diff)

print('output',output)
S = input()
T = input()
ans = len(T)
for start in range(len(S) - len(T)):
  dif = 0
  for i in range(len(T)):
    if T[i] == S[start + i]:
      dif += 1
  ans = min(ans, dif) 
print(ans)
import re

s = input()
t = input()
cnt = -1
for i in range(len(t) + 1):
    cnt += 1
    f = "\S{" + str(i) +"}" + t[(i):len(t)]
    b = t[0:len(t) - i] + "\S{" + str(i) + "}"
    if re.search(f, s):
        print("in")
        break
    elif re.search(b, s):
        print("in")
        break

print(cnt)
s = input()
t = input()
l = len(t)
ans = 0
a = 0
for i in range(len(s) - l + 1):
  ss = list(s[i:i+l])
  for j in range(l):
    if ss[j] ==t[j]:
      ans += 1
    else:
      if a < ans:
        a = ans
        ans = 0
  if a < ans:
    a = ans
  ans = 0
print(l-a)
s = list(str(input()))
t = list(str(input()))

x = [0]
a = 0
for i in range(len(t)):
    for k in range(len(s)):
        if(t[i] == s[k] and ((len(s)- k) >= (len(t)-i)) and (k >= i)):
            a += 1
            for n in range(1,(len(t)-i)):
                if(t[i+n] == s[k+n]):
                    a += 1
                    
    x.append(a)
    a = 0

y = max(x) 

print((len(t) - y))
S = input()
T = input()
lenS = len(S)
lenT = len(T)
maxcnt = 0
for l in range(lenT):
    for r in range(l,lenT):
        if T[l:r+1] in S[l:lenS-lenT+r+1]:
            maxcnt = max(maxcnt, r - l + 1)
print(lenT - maxcnt)
# -*- coding: utf-8 -*-
def cout_dif(a, b):
    sum = 0
    for i in range(len(a)):
        if a[i] != b[i]:
            sum += 1
    return sum
    
def main():
    s = input()
    t = input()
    min = 10**5
    for i in range(len(s)-len(t)):
        sum = cout_dif(t, s[i:i+len(t)+1])
        if sum < min:
            min = sum
    print(min)

if __name__ == '__main__':
    main()
s = input()
t = input()
ans = 0
for i in range(len(s)-len(t)+1):
    m = 0
    for j, k in zip(s[i:],t):
        if j==k:
            m += 1
    if m > ans:
        ans = m
print(ans)
S = input()
T = input()

min_count = len(T)
for i in range(len(S) - len(T)):

    count = 0
    for x in range(len(T)):
        if S[i+x] != T[x]:
            count += 1

    if count < min_count:
        min_count = count

print(min_count)
from functools import reduce
s, t = input(), input()
ans = 10**9
for i in range(0, len(s) - len(t)):
    ans = min(ans, reduce(lambda x, a: x + (1 if a[0] != a[1] else 0), zip(s[i:], t), 0))
print(ans)
def resolve():
	S = list(input())
	T = list(input())
	lenT = len(T)
	res = lenT
	for i in range(len(S)-lenT):
		tmp = lenT
		for j in range(lenT):
			if S[i+j] == T[j]:
				tmp -= 1
		res = min(res, tmp)
	print(res)
resolve()
s = input()
t = input()
slen = len(s)
tlen = len(t)
ans = 10000
temp = 0

for start in range(0,slen-tlen):
    for i in range(0,tlen):
        if t[i] != s[start+i]:
            temp += 1
    ans = min(ans,temp)
    temp = 0

print(ans)
import sys
from sys import stdin
input = stdin.readline

INF = 10**9

s = input()
t = input()
ans = INF
for i in range(len(s) - len(t) + 1):
  cnt = 0
  for j in range(len(t)):
    if (s[i+j] != t[j]): cnt += 1
  ans = min(cnt, ans)
print(ans)
S = input()
T = input()

cnt = 0
for i in range(len(S)):
    tmp = 0
    for j in range(len(T)):
        if i + j < len(S) and S[i + j] == T[j]:
            tmp += 1
        else:
            cnt = max(cnt, tmp)
            tmp = 0
    cnt = max(cnt, tmp)

print(len(T) - cnt)
s = input()
t = input()

ans = len(t)
for i in range(len(s)-len(t)+1):
  tmp=0
  for j in range(len(t)):
    if t[j] == s[i+j]:
      tmp+=1
  ans = min(tmp,ans)
  
print(ans)
S = str(input())
T = str(input())

max_len = 0
for left in range(len(T)):
    for right in range(left, len(T)):
        tmp = T[left:right]
        tmpS = S[left:-(len(T) - right)]
        # print(tmp, tmpS)
        if tmp in tmpS:
            max_len = max(len(tmp), max_len)

print(len(T) - max_len)
s = input()
t = input()

maiores = []
maior = 0

for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if s[i+j] == t[j]:
            maior += 1
            if j == len(t)-1:
                maiores.append(maior)
        else:
            maiores.append(maior)
            maior = 0

print(len(t) - max(maiores))
S = input()
T = input()

Min = 100000

for i in range(len(S) - len(T) + 1):
    count = 0
    for n in range(len(T)):
        if S[i + n] != T[n]:
            count += 1
    if count < Min:
        Min = count

print(count)
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


s = S()
t = S()
ans = INF
for i in range(len(s)-len(t)):
    now = 0
    for j in range(i, i+len(t)):
        if s[j] != t[j-i]:
            now += 1
    ans = min(ans, now)

print(ans)
s = input()
t = input()
l = len(t)

flag = False
for i in range(l):
    k = l - i
    for j in range(i+1):
        a = t[j:k+j]
        if a in s:
            flag = True
            break
    if flag:
        break
if flag:
    print(i)
else:
    print(l)
s=str(input())
t=str(input())
lens=len(s)
lent=len(t)
cnt=1000
for i in range(lens-lent):
  temp=0
  for j in range(lent):
    if t[j]!=s[i+j]:
      temp+=1
  if temp<cnt:
    cnt=temp
print(cnt)
S = input()
T = input()
A = len(T)
for i in range(len(T)):
    M = S.find(T[i:])
    if M >= i and A > i:
        A = i
for i in range(1,len(T)):
    M = S.rfind(T[:i])
    if M >= i and A > i:
        A = i
print(A)
S=input()
T=input()
match=0
for i in range(len(S)-len(T)):
    count=0
    for j in range(len(T)):
        if S[i+j]==T[j]:
            count=count+1
    if match<count:
        match=count
print(len(T)-match)
s = input()
t = input()
ls = len(s)
lt = len(t)

flag = False
for i in range(lt):
    for j in range(i+1):
        a = i-j
        ss = s[j:ls-a]
        tt = t[j:lt-a]
        if tt in ss:
            flag = True
            break
    if flag:
        break
if flag:
    print(i)
else:
    print(lt)
S, T = [input() for i in range(2)]
ans = 0

for i in range(len(S)-len(T)):
    diff = 0

    for j in range(len(T)):
        if T[j] == S[i+j]:
            diff +=1
    ans = max(ans, diff)

print(len(T)-ans)
def main():
    S = input()
    T = input()
    temp = ''
    for i in range(1, len(T)+1):
        print(T[0:i])
        if T[0:i] in S:
            temp = T[0:i]

    print(len(T)- len(temp))

if __name__ == '__main__':
    main()
import re
S = input()
T = input()
ast = []

flag = False
if T in S:
    print(0)
else:
    for i in range(1, len(T) + 1):
        if flag:
            break
        for s in range(len(T) + 1 - i):
            Tc = T
            Tc = Tc.replace(Tc[s:s+i], "."*i)
            if len(re.findall(Tc, S)) != 0:
                print(i)
                flag = True
                break
s=input()
t=input()
ans=len(t)
for i in range(len(s)):
    s1=s[i:i+len(t)]
    sum=len(t)
    for j in range(len(s1)):
        if t[j]==s1[j]:sum-=1
    ans=min(ans,sum)
print(ans)
S = input()
T = input()

ans = len(T)
for i in range(len(T)):
    for j in range(i+1,len(T)+1):
        if T[i:j] in S:
            if i - S.find(T[i:j]) <= 0:
            	ans = min(ans, len(T)-len(T[i:j]))
print(ans)
s = input()
t = input()
ans = 0
for i in range(len(t)):
    if s.count(t[i:]) != 0:
        ans = (len(t[i:]))
        break
if s.count(t[:-1]) != 0:
    ans = max((len(t[1:])),ans)
print(len(t)-ans)
s = input()
t = input()

if (t in s):
    print(0)

ans = 1000
for i in range(len(s)-len(t)):
    diff = 0
    for j in range(len(t)):
        if (s[i+j] == t[j]):
            pass
        else:
            diff += 1
    
    ans = min(ans, diff)

print(ans)
*S, = input()
*T, = input()

sl = len(S)
tl = len(T)

ans = tl
for i in range(sl):
    if i+tl >= sl:
        break
    count = 0
    for j in range(tl):
        if S[i+j] != T[j]:
            count += 1
    ans = min(ans, count)
print(ans)
s=input()
t=input()
ans=1000
for i in range(len(s)-len(t)):
    tmp=0
    for j in range(len(t)):
        if(s[i+j]!=t[j]):
            tmp+=1
    ans=min(ans,tmp)
print(ans)
# -*- coding: utf-8 -*-

s = input()
t = input()
answer = 0
for start_i in range(len(s)-len(t)):
  compared_s = s[start_i:]
  index = 0
  matched_count = 0
  for t_s in t:
    if t_s == compared_s[index]:
      matched_count += 1
    index += 1
  if answer < matched_count:
    answer = matched_count

print(len(t)-answer)
S = input()
T = input()

ans = len(T)
l = len(T)
for m in range (len(S)-l):
    diff = 0
    for i in range (l):
        if S[m+i] != T[i]:
            diff+=1
    ans = min(ans, diff)

print(ans)
def s():return input()
def mp():return map(int,input().split())
a =s()
b =s()
ans = ""
q,w =0,0
for i in range(len(b)):
	ans+=b[i]
	if ans in a[i:]:
		q+=1
	else:
		ans =""
		q =0
	w = max(w,q)
print(len(b)-w)
L = input()
S = input()
result = 0

for i in range(len(S)):
    tmp = 0
    for j in L[i:]:
        if i + tmp > len(S)-1:
            break
        if S[i+tmp] == j:
            tmp += 1
        else:
            if result < tmp:
                result += tmp
            tmp = 0
print(len(S) - result)
S = input()
T = input()
num_S = len(S)
num_T = len(T)
match = 0

for i in range(num_S - num_T):
    count = 0
    for j in range(num_T):
        if S[i+j] == T[j]:
            count += 1
    if count > match:
        match = count

print(num_T - match)
S = input()
T = input()

cnt_min = len(S)
for i in range(len(S) - len(T)):
    cnt = 0
    for j in range(len(T)):
        if T[j] != S[i+j]:
            cnt += 1
    cnt_min = min(cnt_min, cnt)

print(cnt_min)
S = input()
T = input()
m = 0
for i in range(len(T)):
  for j in range(i+1,len(T)+1):
       if T[i:j] in S:
            ind = S.index(T[i:j])
            if ind >= i and len(S)-ind >= len(T[i:]):
              #print(T[i:j], ind)
              m = max(m,len(T[i:j]))
print(len(T)-m)
s = input()
t = input()

t_length = len(t)

for i in range(t_length):
  if t[0:t_length - i] in s:
     break   
print(i)
S = input()
T = input()

size = len(T)
n = len(S)
ans = size

for i in range(n-size):
    t = S[i:i+size]
    v = sum([k!=j for k, j in zip(T, t)])
    ans = min(v, ans)

print(ans)
s=input()
t=input()
u=m=len(t)
for i in range(len(s)-u):
	m=min(m,sum([1 for j in range(u) if s[i+j]!=t[j]]))
print(m)
s = input()
t = input()

ans = 0
for i in range(len(s)):
    count = 0
    for j in range(i, len(t)):
        if s[j] == t[j-i]:
            count += 1
    ans = max(count, ans)
print(len(t)-ans)
s = input()
t = input()

ans = len(t)
for i in range(len(s)-len(t)):
    same = 0
    for g in range(len(t)):
        if s[i+g] == t[g]:
            same += 1
    ans = min(len(t)-same, ans)

print(ans)
s = input()
t = input()

ans = float("INF")
for i in range(len(s)-len(t)):
    x = 0
    for j in range(len(t)):
        
        x += (s[i+j] != t[j])
    ans = min(ans,x)
print(ans)
S = list(input())
T = list(input())
ans = 1e9

for i in range(len(S) - len(T) + 1):
    print(S[i:len(T)+i],T)
    tmp = 0
    for j in range(len(T)):
        if S[i:len(T)+i][j] == T[j]: continue
        tmp += 1
    ans = min (ans,tmp)

print(ans)
s = input()
t = input()
list = []

for i in range(len(s)-len(t)+1):
    n=0
    for j in range(len(t)):
        if s[i] == t[j]:
            n+=1
    list.append(n)
print(len(t)-max(list))
s=input()
t=input()

min=len(t)
for n in range(len(s)-len(t)):
    x=0
    for i in range(len(t)):
        if t[i] != s[n+i]:
            x=x+1

    if x<min:
        min = x
print(min)
s = input()
t = input()


ans = 0
flag = False
for i in range(len(t)+1, 0, -1):
    for j in range(0, len(t)-i+1):
        if t[j:j+i] in s:
            ind = s.index(t[j:j+i])
            if ind >= j and len(s[ind:]) - len(t[j:]) >= 0:
                ans = i
                flag = True
                break

    if flag:
        break


print(len(t)-ans)
s = input()
t = input()
mx = float('-inf')
for i in range(0, len(s)-len(t)+1):
    # print(i)
    k = 0
    cnt = 0
    for j in t:
        # print(s[i], j)
        if s[i+k]==j:
            cnt+=1
            mx = max(cnt, mx)
        k+=1
print(len(t)-mx)
S=input()
T=input()
ans=int(len(T))
for i in range(int(len(S))-int(len(T))):
    x=int(len(T))
    for j in range(int(len(T))):
        if S[i+j]==T[j]:
            x-=1
        if j+1==int(len(T)):
            if ans>x:
                ans=x
print(ans)
s = str(input())
t = str(input())
a = []
for i in list(s):
    a.append(i)
b = []
for j in list(t):
    b.append(j)
c = len(a)
d = len(b)
w = 1000
for k in range(c-d):
    e = a[k:k+d]
    f = 0
    for l in range(d):
        if e[l] != b[l]:
            f= f+1
    if w > f:
         w= f
print(w)
s = input().rstrip()
t = input().rstrip()
count = 0
min_count = 1000
for i in range(len(s) - len(t)):
    s_selected = s[i:i + len(t)]
    count = 0
    for j in range(len(t)):
        if t[j] != s_selected[j]:
            count += 1
    #print(count)
    if count < min_count:
        min_count = count
print(min_count)
S = input()
T = input()
Min_count = len(T)

for i in range(len(S)-len(T)):
    count = 0
    for h in range(len(T)):
        if(S[i+h] != T[h]):
            count+=1
    if(Min_count >count):
        Min_count = count

print(Min_count)
s = input()
t = input()
ans = 10000

for i in range(len(s)-len(t)):
    cut = s[i:i+len(t)]
    cnt = 0
    for k, j in zip(cut, t):
        if k != j:
            cnt += 1
    ans = min(ans, cnt)

print(ans)
def main():
    S = input()
    T = input()

    min_change = 1e5
    for i in range(len(S)-len(T)):
        tmp_change = 0
        for j in range(len(T)):
            if S[i+j] != T[j]:
                tmp_change += 1
        min_change = min(min_change, tmp_change)

    print(min_change)


if __name__ == '__main__':
    main()
S = input()
T = input()

s = len(S)
t = len(T)

min_count = t
for i in range(s - t):
    count = 0
    for j, tt in enumerate(T):
        if S[i: i + t][j] == tt:
            count += 1
    change = t - count
    if change < min_count:
        min_count = change
print(min_count)
S=input()
T=input()
N=len(S)
ans=10**30
for i in range(N-len(T)):
    cnt=0
    for j in range(i,i+len(T)):
        if S[j]!=T[j-i]:
            cnt+=1
    ans=min(ans,cnt)
print(ans)
import re

def judge(T,S):
  length=len(T)
  if T in S:
    return length
  else :
    for i in range(1,length):
      for j in range(length):
        t=T[:j]+"."*i+T[j+i:length]
        if re.search(t,S):
          return i
          break


S=input()
T=input()

print(judge(T,S))
S = input()
T = input()

max_count = 0
for start in range(len(T)):
    for end in range(start, len(T)):
        if T[start:end] in S[start:]:
            count = end - start
            max_count = max(max_count, count)

answer = len(T) - max_count
print(answer)
S = input()
T = input()
i = len(T)
sub_str = ''
ans = -1
while i > 0:
    sub_str = T[0:i]
    i = i - 1
    if sub_str in S:
        ans = len(T) - len(sub_str)
        break
if ans != -1:
    print(ans)
elif set(list(S)) & set(list(T)):
    print(len(T) - 1)
else:
    print(len(T))
S=input()
T=input()

max_ans=0
for i in range(len(S)):
  max_n = 0
  for j in range(len(T)):
    if len(S) > i + j:
      if S[i+j]==T[j]:
      	max_n=max_n+1
  
  if max_ans <= max_n:
    max_ans=max_n

print(len(T)-max_ans)
s = input()
t = input()

l = len(s)
k = len(t)
min = 1002

for j in range(0,k):
    t1 = t[0:k-j]
    for i in range(0,l-k+j+1):
        s1 = s[i:i+k-j]
        if t1 == s1:
            if min > k-i-1:
                min = k-i-1
                break
    if min != 1002:
        break
            
print(min)
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    S = input()
    T = input()
    m = len(S)
    l = len(T)
    # m > l
    ans = INF
    for i in range(m - l + 1):
        ans = sum(s != t for s, t in zip(S[i : i + l], T))
    print(ans)
resolve()
s = list(input())
t = list(input())

ans = len(t)
for i in range(len(s)-len(t)):
  a = s[i:i + len(t)]
  icchi = 0
  for j in range(len(t)):
    if a[j] == t[j]:
      icchi += 1
  ans = min(ans, len(t)-icchi)


print(ans)
S = str(input())
T = str(input())

result =0

cnt = len(T)

temp = S[:cnt]

Min  = len(T)

while True:
    sum = 0
    for i in range (len(T)):
        if temp[i] != T[i]:
            sum+=1
    
    result = min(Min,sum)
    
    if cnt+len(T) <= len(S):
        temp = S[cnt:cnt+len(T)]
        cnt = cnt+len(T)
    else:
        break
    
    
print(result)
S = input()
T = input()
temp = T
ans = 0
ret = False
t = list(T)
s = list(S)
t_ans = len(t)
f_ans = len(t)
for i in range(len(t)):
    if T in S:
        t_ans = ans
        ret = True
        break
    ans += 1
    T = T[:-1]
T = temp
ans = 0
for i in range(len(t)):
    if T in S:
        f_ans = ans
        ret = True
        break
    ans += 1
    T = T[1:]
if ret:
    print(min(f_ans, t_ans))
else:
    print(len(t))
# coding: utf-8

def main():
    s = input()
    t = input()

    ans = len(t)
    
    for i in range(len(s) - len(t)):
        a = s[i:i+len(t)]
        print(a, t)
        ans_list = [1 for x, y in zip(a, t) if x!=y]
        tmp_ans = sum(ans_list)
        ans = min(ans, tmp_ans)
        
        if ans == 0:
            break
        
    print(ans)
    
        

main()
s = input()
t = input()

len_s = len(s)
len_t = len(t)

ans = 1000
for i in range(len_s - len_t):
    cnt = 0
    for j in range(len_t):
        if s[i + j] == t[j]:
            cnt += 1
        else:
            ans = min(ans, len_t - cnt)
            continue

print(ans)
def check(S,T,i):
	count=0
	for j in range(i,len(T)+i):
		if S[j] == T[j-i]:
			count+=1
	return count

S=input()
T=input()
b=[]
for i in range(0,len(S)-len(T)+1):
	b.append(check(S,T,i))
b.sort()
print(b[0])
S = input()
T = input()

for i in range(len(T)):
    if not (T[0:i] in S):
        break

print(len(T) - i)
s = input()
t = input()

maxsame = 0

for i in range(len(s)-len(t)):
  same = 0
  for j in range(len(t)):
    if s[i+j] == t[j]:
      same += 1
    else:
      same = 0
    if same > maxsame:
      maxsame = same
    
print(len(t)-maxsame)
S=input()
T=input()
ans=10**5
for i in range(len(S)-len(T)):
  a=0
  for j in range(len(T)):
    if S[i+j]==T[j]:
      a+=1
  ans=min(ans,a)
print(ans)
def func(S,T):
  tlen = len(T)
  min = 1000
  for x in range(0,len(S)-tlen,1):
    tmp = S[x:x+tlen]
    tmpNum = 0
    for i in range(0,len(tmp),1):
      if tmp[i] != T[i]:
        tmpNum += 1
    if min > tmpNum:
      min = tmpNum
  if min == 1000:
    min = tlen
  return min

if __name__ == "__main__":
    S = input()
    T = input()
    print(func(S,T))
def diff(s,t):
    assert len(s) == len(t)
    c = 0
    for i,j in zip(s,t):
        if i != j:
            c+=1
        else:
            pass
    return c
s=input()
t=input()
n=len(s)
m=len(t)
min_=10**5
for i in range(n-m):
    min_=min(min_,diff(s[i:m+i],t))
print(min_)
##全探索...?
S = input()
T = input()

last = len(S) - len(T) + 1
ans = len(T)

for i in range(last):
    tent = 0
    for j in range(len(T)):
        if(S[i+j] != T[j]):
            tent += 1
    print(tent)
    if(tent < ans):
        ans = tent
print(ans)
s=input()
t=input()


ma=0
for i in range(len(s)):
  cnt=0
  now=s[i:i+len(t)]

  
  for j in range(len(now)):
    if now[j]==t[j]:
      cnt+=1
  ma=max(cnt,ma)
print(len(t)-ma)
S = list(input())
T = list(input())

ans = 0
for i in range(len(S)-len(T)):
    ans_pre = 0
    for j in range(len(T)):
        if T[j] == S[i+j]:
            ans_pre += 1
    ans = max(ans, ans_pre)
    
print(len(T) - ans)
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

s = [_ for _ in input()]
t = [_ for _ in input()]

ans = 10**10

for i in range(len(s) - len(t)):
  a = 0
  for j in range(len(t)):
    if s[+j] != t[j]:
      a+=1
  ans = min(a,ans)
print(ans)
from collections import defaultdict
S = input()
T = input()
mic = len(T)
if T in S:
  print(0)
else:
  for i in range(len(S)-len(T)):
    counter = 0
    for l in range(len(T)):
      if T[l] != S[i+l]:
        counter+=1
    mic = min(mic,counter)
  print(mic)
s = input()
t = input()
minCount = 100000000
i = 0
while i < len(s):
    countSame = 0
    j = 0
    while j < len(t) and i+j < len(s):
        if t[j] == s[i+j]:
            countSame += 1
        j += 1
        minCount = min(len(t) - countSame, minCount)
    i += 1
print(minCount)
#B
S = input()
T = input()
def counter(A,B):
    tmp = 0
    for j in range(len(A)):
        if A[j]==B[j]:
            tmp += 1
    return tmp
result = 0
if S == T:
    result = len(T)
else:
    for i in range(len(S)-len(T)):
        if counter(S[i:i+len(T)],T) > result:
            result = counter(S[i:i+len(T)],T)
print(len(T)-result)
s = input()
t = input()
maxi = 0 
if t not in s:
    for i in range(len(s)):
        maxG = 0
        for l, j in zip(s[i:len(t)], t):
            if l == j:
                maxG += 1
        maxi = max(maxi, maxG)
    print(len(t)-maxi)
else:
    print("0")
S = input()
T = input()

ans = len(T)

for i in range(len(S)-len(T)-1):
    tmp = ans
    tmp = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            tmp += 1
    if tmp < ans:
        ans = tmp
print(ans)
def main():
    S = input()
    T = input()
    if T in S:
        print(0)
    else:
        for i in range(len(T)-1, 0, -1):
            for j in range(len(T)-i+1):
                if T[j:j+i] in S[j:]:
                    print(len(T) - i)
                    exit()


if __name__ == '__main__':
    main()
def main():
  s=input()
  t=input()
  ls=len(s)
  lt=len(t)
  st= [ [ 0 for y in range(ls ) ] for x in range( lt ) ]
  for si in range(ls):
    for ti in range(lt):
      if s[si]==t[ti]:
        st[ti][si]=1
        break
  r=0
  for si in range(ls):
    rt=0
    for ti in range(lt-si):
      rt+=st[ti][(si+ti)]
    if r<rt:
      r=rt
  print(lt-r)
main()