peterverebics/CodeNet_Python_118 huggingface dataset:
s = input()
t = input()

s_l = len(s)
t_l = len(t)

max_count = 0
for i in range(0, s_l - t_l + 1):
  count = 0
  for j in range(0, t_l):
    if s[i+j] == t[j]:
      count += 1
  if count > max_count:
    max_count = count

diff = t_l - max_count
print(diff)
t = input()
s = input()

mxscore = -1
beststr = ''
for i in range(len(s),len(t)+1):
    check = t[i-len(s):i]
    now = 0
    for j in range(len(check)):
        if s[j] == check[j]:
            now += 1
    if now > mxscore:
        mxscore = now

print(len(s)-mxscore)
S = input()
T = input()

min_val = len(S)
for i in range(0,len(S)-len(T)+1):
  count = 0
  for j in range(i, i+len(T)):
    if S[j] == T[j-i]:
      count += 1
  min_val = min(min_val, len(T)-count)
print(min_val)
import math
min = math.inf
S = input()
T = input()

len_t = len(T)
for s in range(0,len(S)-len_t+1):
    sub = S[s: s+len_t]
    diff = 0
    for i in range(len_t):
        if sub[i] != T[i]:
            diff += 1
            if diff > min:
                break
    else:
        if diff < min:
            min = diff
print(min)
S = input()
T = input()
ans = len(T)
if len(T)==len(S):
    loop = 1
else:
    loop = len(S)-len(T)
for i in range(loop):
    diff = 0
    for s, t in zip(S[i:i+len(T)], T):
        if s!=t:
            diff += 1
    ans = min(ans, diff)
print(ans)
s = input()
t = input()
ans = float("inf")
for i in range(len(s) - len(t) + 1):
    temp = 0
    for j in range(len(t)):
        if t[j] != s[i + j]:
            temp += 1
    ans = min(ans, temp)
print(ans)
s1 = str(input())
s2 = str(input())
diff=[]
for i in range(0,len(s1)-len(s2)+1):
  str1 = s1[i:i+len(s2)]
  #print(str1)
  val=0
  for i in range(len(str1)):
    if(abs(ord(str1[i])-ord(s2[i])) > 0):
      val += 1
  diff.append(val)
print(min(diff))
from functools import reduce
import sys


def dump(x):
    print(x, file=sys.stderr)


s = input()
t = input()

min_diff = 100000000000


for i in range(len(s)-len(t)+1):
    matches = [1 if s[i+j] != t[j] else 0 for j in range(len(t))]
    diffn = sum(matches)
    min_diff = min(diffn,min_diff)
    dump(min_diff)

print(min_diff)
S = input()
T = input()

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

print(ans)
S=input()
T=input()
LS=len(S)
LT=len(T)
ans=0

for i in range(LS-LT+1):
    cnt=0
    kari=S[i:i+LT]
    for j in range(LT):
        if kari[j]==T[j]:
            cnt+=1
    #print(kari,cnt,ans)
    ans=max(cnt,ans)        

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

li=[]

for i in range(0,len(s)-len(t)+1):
    li.append(s[i:i+len(t)])

maxi=0
for w in li:
    count=0
    for k in range(len(t)):
        if(w[k]==t[k]):
            count+=1
    maxi=max(maxi,count)
print(len(t)-maxi)
s = input()
t = input()
n = len(s)
m = len(t)
ans = m
for i in range(n-m+1):
    x = m
    for j in range(m):
        if s[i+j] == t[j]:
            x -= 1
    ans = min(ans,x)
print(ans)
S = input()
T = input()
ans = float("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(ans,cnt)
print(ans)
s = input()
t = input()

ans = float("inf")

for i in range(len(s) - len(t) + 1):
    num = 0
    for j in range(len(t)):
        if s[i + j] == t[j]:
            continue
        else:
            num += 1

    ans = min(ans, num)

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

S_len = len(S)
T_len = len(T)
A_sum = []
count = 0

for i in range(S_len - T_len + 1):
    for j in range(T_len):
        if S[i+j] == T[j]:
            count += 1
    A_sum.append(count)
    count = 0

ans = T_len - max(A_sum) 

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

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

ans = len_T
for i in range(0, len_S - len_T + 1):
    match = 0
    for s, t in zip(S[i:i + len_T], T):
        if s == t:
            match += 1
    change = len_T - match
    ans = min(ans, change)

print(ans)
s=input()
t=input()
mini=10000
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
    mini=min(mini, cnt)
print(mini)
s = input()
t = input()

def num_of_match(a,b):
    l = len(a)
    return sum([a[i] == b[i] for i in range(l)])


t_len = len(t)
nom_list = []
finish_flg = False
for i in range(len(s) - len(t) + 1):
    s_sub = s[i:i + t_len]
    nom = num_of_match(s_sub, t)
    num_mod = t_len - nom
    if num_mod == 0:
        print(0)
        finish_flg = True
        break
    else:
        nom_list.append(num_mod)

if not finish_flg:
    print(min(nom_list))
s=input()
t=input()

ans=len(s)
for i in range(len(s)-len(t)+1):
    res=len(t)
    s_slice=s[i:i+len(t)]
    for j in range(len(t)):
        if s_slice[j]==t[j]:
            res-=1
    ans=min(res,ans)
print(ans)
S = str(input())
T = str(input())
Snagasa = len(S)
Tnagasa = len(T)
saisyuicchi = 0
for i in range (Snagasa-Tnagasa+1):
 icchi = 0
 for j in range (Tnagasa):
  if S[i+j] == T[j]:
   icchi = icchi + 1
  else:
   icchi = icchi
 if icchi > saisyuicchi:
  saisyuicchi = icchi
ans = Tnagasa - saisyuicchi
print (ans)
S = input()
T = input()

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

ans = m

for i in range(n-m+1):
    xs = S[i:i+m]
    cnt = 0
    for j in range(m):
        if xs[j] != T[j] :
            cnt += 1
    ans = min(ans, cnt)
    
print(ans)
a = input()
b = input()

arr = []
la = len(a)
lb = len(b)

for i in range(la-lb+1):
    c = a[i:i+lb] 
    cu = 0
    for j in range(lb):
        if c[j] != b[j]:
            cu += 1
    arr.append(cu)
    
print(min(arr))
s, t = input(), input()
ret = len(t)
for i in range(len(s)-len(t)+1):
    u = s[i:len(t)+i]
    count_diff = 0
    for j in range(len(u)):
        if u[j] != t[j]:
            count_diff += 1
    ret = min(ret, count_diff)
print(ret)
S = str(input())
T = str(input())
ans = 1000
for i in range(len(S) - len(T) + 1):
    c = 0
    for j in range(len(T)):
        if S[i] != T[j]:
            c += 1
        i += 1
    ans = min(ans, c)
print(ans)
s = input()
t = input()

n = len(s)
nt = len(t)

ans = 1000
for i in range(n - nt + 1):
    string = s[i:i + nt]

    count = 0
    for c1, c2 in zip(string, t):
        if c1!=c2: count += 1
    
    ans = min(ans, count)

print(ans)
s = input()
t = input()
S = [c for c in s]
T = [c for c in t]
m = len(T)
for i in range(len(S)-len(T)+1):
  temp = 0
  for j in range(i,i+len(T)):
    if S[j] != T[j-i]:
      temp += 1
  if temp<m:
    m=temp
print(m)
s=input()
t=input()
ans=1000
for i in range(len(s)-len(t)+1):
    tmp=0
    for j in range(len(t)):
        if s[i+j]!=t[j]:
            tmp+=1
    if ans>tmp:
        ans=tmp
print(ans)
s=input()
t=input()
k=len(t)
for i in range(len(s)-len(t)+1):
    q=0
    for j in range(len(t)):
        if s[i+j]!=t[j]:
            q+=1
    if k>q:
        k=q
print(k)
s=input()
t=input()
res=len(t)
for i in range(len(s)-len(t)+1):
    tmp=0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            tmp+=1
    res=min(tmp,res)
print(res)
s = input()
t = input()
lt = len(t)
ls = len(s)
A = []
for i in range(ls-lt+1):
    cou = 0
    for j in range(lt):
        if s[i+j] == t[j]:
            cou += 1
    A.append(cou)
print(lt-max(A))
s=input()
t=input()
sl=len(s)
tl=len(t)
kotae=tl
for i in range(0,sl-tl+1):
  x=s[i:i+tl]
  b=0
  for j in range(tl):
    if x[j]!=t[j]:
      b+=1
  if b<kotae:
    kotae=b
print(kotae)
#b
s = input()
v = input()
ans = 0
for i in range(len(s)-len(v)+1):
    count = 0
    for j in range(len(v)):
        if s[i+j] == v[j]:
            count += 1
    if count > ans:
        ans = count
print(len(v) - ans)
s=input()
t=input()

slen=len(s)
tlen = len(t)
min = tlen

for i in range(slen - tlen + 1):
    count = 0
    for j in range(tlen):
        if s[i + j] != t[j]:
            count += 1
    if count < min:
        min = count

print(min)
def equ(a, b):
    if a == b:
        return 1
    else:
        return 0


s = input()
t = input()
max_equ = 0

for i in range(len(s) - len(t) + 1):
    count = 0
    for j in range(len(t)):
        count += equ(s[i + j], t[j])
    if count > max_equ:
        max_equ = count
print(len(t) - max_equ)
import sys

s = input()
t = input()

finalans = 1000000
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
    finalans = min(finalans, ans)

print(finalans)
S = input()
T = input()
ans = len(T)
n1 = len(S)-len(T)+1
for i in range(n1):
    ans2 = 0
    for k in range(len(T)):
        # print(S[k+i],T[k])
        if S[k+i] != T[k]:
            ans2 += 1
    
    ans = min([ans,ans2])
    # print(ans)
print(ans)
def main():
    S = input()
    T = input()

    ans = 10**4
    for i in range(len(S)-len(T) + 1):
        count = 0
        for j in range(len(T)):
            if S[i + j] != T[j]:
                count += 1

        if ans > count :
            ans = count 

    if ans == 10**4:
        print(len(T))
    else:
        print(ans)

if __name__ == "__main__":
    main()
s = input()
t = input()

res = 1000
for i in range(len(s)-len(t)+1):
  tmp = 0
  for j in range(len(t)):
    if s[i+j] != t[j]:
      tmp += 1
  res = min(res, tmp)

print(res)
S=str(input())
T=str(input())
min_count=len(T)
for i in range((len(S)-len(T))+1):
    count=0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            count+=1
    min_count=min(count,min_count)
print(min_count)
s=input()
t=input()
num=len(s)-len(t)
res=[]
for n1 in range(0,num+1):
    count=0
    for n2 in range(0,len(t)):
        if(t[n2]!=s[n1+n2]):
            count+=1
    res.append(count)
print(min(res))
S=str(input())
T=str(input())
ls = []
cnt = 0
for i in range(len(S)-len(T)+1):
    cnt = 0
    for j in range(len(T)):
        #print(i,j)
        if T[j] != S[j+i]:
            #print(T[j],S[j+i])
            cnt += 1
    ls.append(cnt)
#print(ls)
print(min(ls))
s = input()
t = input()
ls = []
for i in range(len(s) - len(t) + 1):
    ls.append(s[i:i+len(t)])
now = 0
minimum = len(t)
for i in range(len(ls)):
    now = 0
    for j in range(len(t)):
        if t[j] == ls[i][j]:
            now += 1
    if len(t) - now < minimum:
        minimum = len(t) - now
print(minimum)
S = input()
T = input()

max_count = 0
for i in range(max(1, len(S) - len(T))):
    count = 0
    for j in range(len(T)):
        if S[i+j] == T[j]:
            count += 1
    max_count = max(max_count, count)
    
print(len(T) - max_count)
S=input()
T=input()
a=[]
for i in range(len(S)-len(T)+1) :
  count=0
  for j in range(len(T)) :
    if S[i:i+len(T)][j]==T[j] :
      count+=1
  a.append(count)
print(len(T)-max(a))
s = input()
t = input()
ans = 10 ** 10
ls = len(s)
lt = len(t)
for i in range(ls - lt + 1):
    cnt = 0
    for j in range(lt):
        if s[i + j] != t[j]:
            cnt += 1
    ans = min(ans, cnt)
print(ans)
s = input()
t = input()
if len(s) <= len(t):
    a = s; s = t; t = a
res = 0
for i in range(len(s)-len(t)+1):
    temp = 0
    for j in range(len(t)):
        if s[j+i] == t[j]:
            temp+=1
    res = max(temp, res)

ans =len(t) - res
print(ans)
s =input()
t = input()
len_s = len(s)
len_t = len(t)
ans = 10**10
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()

d = len(s) - len(t)
min_c = int(1e4)
for i in range(d+1):
    st = s[i:i+len(t)]
    c = 0
    for j in range(len(t)):
        if st[j] != t[j]:
            c += 1
            if c > min_c:
                break
    min_c = min(c, min_c)

print(min_c)
from functools import reduce
s, t = input(), input()
ans = 10**9
for i in range(0, len(s) - len(t)+1):
    ans = min(ans, reduce(lambda x, a: x + (1 if a[0] != a[1] else 0), zip(s[i:], t), 0))
print(ans)
s= input()
t =  input()
n =  len(s)
n1 = len(t)
ans= 100000
for i in range(n-n1+1):
    count= 0
    for j in range(n1):
        #print(i,j,n,n1)
        if s[i+j]==t[j]:
            continue
        else:
            count+=1
    #print(count)
    ans = min(ans,count)
print(ans)
s=list(input())
t=list(input())

ans=0
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=max(ans,cnt)

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

count = len(t)

for i in range(len(s) - len(t) + 1):
    str_ = s[i:i + len(t)]
    temp = 0
    for i in range(len(str_)):
        #print(str_[i])
        if str_[i] != t[i]:
            temp += 1
    count = min(count, temp)    
        
print(count)
import sys

def solve():
      input = sys.stdin.readline
      S = input().strip("\n")
      T = input().strip("\n")
      minChange = len(T)
      for i in range(len(S) - len(T) + 1):
            c = 0
            for j in range(len(T)):
                  if S[i + j] != T[j]: c += 1
            minChange = min(minChange, c)
      print(minChange)

      return 0

if __name__ == "__main__":
      solve()
s=input()
t=input()

count_max = 0
for i in range(0, len(s)-len(t)+1):
    count_tmp = 0
    for j in range(len(t)):
        if s[i+j]==t[j]:
            count_tmp += 1
    if count_max < count_tmp:
        count_max = count_tmp

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

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

print(min(cnt))
S = input()
T = input()
ans = 1001
for i in range(len(S) - len(T) + 1):
  a = 0
  for s in range(len(T)):
    if T[s] != S[i+s]:
      a += 1
  if a < ans:
    ans = a
print(ans)
S = input()
T = input()

res = 0
for i in range(len(S) - len(T) + 1):
    tmp = 0
    for j in range(len(T)):
        if S[i+j] == T[j]:
            tmp += 1
    res = max(res, tmp)

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

ls = len(s)
lt = len(t)
max = 0
for i in range(ls-lt+1):
  k = 0
  for j in range(i,i+lt):
    if s[j] == t[j-i]:
      k += 1
  if max < k:
    max = k
    
print(lt-max)
def main():
    S = list(input())
    T = list(input())
    ans = float('inf')
    for i in range(len(S)):
        cnt = 0
        flag = True
        for j in range(len(T)):
            if i + j >= len(S):
                flag = False
                break
            if S[i+j] != T[j]:
                cnt += 1
        if flag:
            ans = min(ans, cnt)

    print(ans)




if __name__ == "__main__":
    main()
s=input()
t=input()
ans=len(t)
for i in range(len(s)-len(t)+1):
    s1=s[i:i+len(t)]
    sum=len(t)
    for j in range(len(t)):
        if t[j]==s1[j]:sum-=1
    ans=min(ans,sum)
print(ans)
S = input()
T = input()

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

ans = 10**10
for i in range(len_S - len_T+1):
    num = 0
    for j in range(len_T):
        if S[i+j] != T[j]:
            num+=1
    ans = min(ans, num)

print(ans)
#!/usr/bin/env python

def main():
    s = input() + "#"
    t = input()
    m = len(s)
    n = len(t)

    c_max = 0
    for i in range(m-n):
        cnt = 0
        for j in range(n):
            if s[i+j] == t[j]:
                cnt += 1
        if cnt > c_max:
            c_max = cnt

    print(n - c_max)

if __name__ == '__main__':
    main()
s = input()
t = input()

s = ''.join(s)
t = ''.join(t)


count = 0
maxcount = 0
slen = len(s)
tlen = len(t)
j = 0

while j <= slen-tlen:
    k = j
    for i in range(tlen):
        if t[i] == s[k]:
            count += 1
        k+= 1
    j += 1
    if count > maxcount :
        maxcount = count
    count = 0
print(len(t)-maxcount)
S = input()
T = input()

count = []
for i in range(len(S)-len(T)+1):
    num = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            num += 1
    count.append(num)
print(min(count))
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)+1):
  a = 0
  for j in range(len(t)):
    if s[i+j] != t[j]:
      a+=1
  ans = min(a,ans)
print(ans)
def compare(a, b):
    result = 0
    for i in range(len(a)):
        if a[i] != b[i]:
            result += 1
    return result

s = input()
t = input()

ls = len(s)
lt = len(t)

diff = []
for i in range(ls-lt+1):
    diff.append(compare(s[i:i+lt], t))
print(min(diff))
s = input()
t = input()
minCount = len(t)
i = 0
while i < len(s) and i + len(t) <= len(s):
    countSame = 0
    j = 0
    while j < len(t):
        if t[j] == s[i+j]:
            countSame += 1
        j += 1
        minCount = min(len(t) - countSame, minCount)
    i += 1
print(minCount)
s = input()
t = input()

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

l_s = len(s)
l_t = len(t)

change = l_t
for i in range(l_s - l_t + 1):
    change_temp = 0
    for j in range(l_t):
        if s[i+j] != t[j]:
            change_temp += 1

    change = min(change, change_temp)

print(change)
S = input()
T = input()

s_len = len(S)
t_len = len(T)
R = s_len - t_len
ans = 1000

for i in range(R + 1):
  s_new = S[i : t_len + i]
  count = 0
  for j in range(t_len):
    if s_new[j] != T[j]:
      count += 1
  ans = min(ans, count)

print(ans)
s = input()
t = input()
l = len(s)
t_l = len(t)
l_gap = l - t_l

x = 0
for i in range(l_gap + 1):
  c = 0
  for m in range(t_l):
    if t[m] == s[i+m]:
      c += 1
  if c > x:
    x = c
print(t_l -x)
S = input()
T = input()
def diff_count(A,B):
    diff = 0
    for a,b in zip(A,B):
        if a!=b:
            diff += 1
    return diff
ans = len(T)
for i in range(len(S) - len(T)+1):
    temp = S[i:i+len(T)]
    diff_num = diff_count(T,temp)
    ans = min(diff_num,ans)
print(ans)
s=input()
t=input()
mx=0
for i in range(len(s)-len(t)+1):
    sm=0
    for j in range(len(t)):
        if s[i+j]==t[j]:
            sm+=1
    mx=max(sm,mx)
print(len(t)-mx)
S = input()
T = input()

result = float('inf')
for i in range(len(S) - len(T) + 1):
    count = sum(x != y for x, y in zip(S[i:i+len(T)], T))
    if count < result:
        result = count
print(result)
import sys
S = input()
T = input()

if T in S:
    print(0)
    sys.exit(0)

ans = []
for i in range(len(S)-len(T)+1):
    s = S[i:i+len(T)]
    cnt = 0
    for x, y in zip(s, T):
        if x == y:
            cnt += 1
    ans.append(cnt)
    
print(len(T)-max(ans))
s = list(input())
t = list(input())
ans=len(t)

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

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

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

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

t_l = len(t)
diff_min = 999999999

def diff_str(s1, s2):
    diff_c = 0
    for j in range(len(s1)):
        if s1[j] != s2[j]:
            diff_c += 1
    return diff_c

if len(s) == len(t):
    diff_min = diff_str(s, t)

for i in range(len(s)-t_l):
    seq=s[i:i+t_l]
    diff_c = diff_str(seq, t)
    if diff_c < diff_min:
        diff_min = diff_c


print(diff_min)
s = input()
t = input()
l0 = len(s)
l1 = len(t)
ans = 10**9
for i in range(l0 - l1 + 1):
  x = 0
  for j in range(l1):
    if s[i + j] != t[j]:
      x += 1
  ans = min(ans, x)
print(ans)
S = input()
T = input()
ans = 0
for i in range(len(S) - len(T) + 1):
  count = 0
  for j in range(len(T)):
    if S[i+j] == T[j]:
      count += 1
  ans = max(ans, count)
print(len(T) - ans)
s = input()
t = input()
cnt_max = 0
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
    if cnt > cnt_max:
        cnt_max = cnt
print(len(t)-cnt_max)
s = list(input())
t = list(input())
ls, lt = len(s), len(t)
ans = lt
for i in range(ls - lt + 1):
    cnt = 0
    for j in range(lt):
        if s[i + j] == t[j]:
            cnt += 1
    ans = min(ans, lt - cnt)
print(ans)
S = input()
T = input()
MIS = len(S)
for TS in range(0,len(S)-len(T)+1):
    LS = S[TS:TS+len(T)]
    Count = sum(True if LS[TT]!=T[TT] else False for TT in range(0,len(T)))
    MIS = min(MIS,Count)
print(MIS)
S = input()
T = input()
ans = 0
cnt = 0
for i in range(0, len(S) - len(T)+1):
    cnt = 0
    S_sub = S[i:i+len(T)]
    for j in range(len(T)):
        if S_sub[j] == T[j]:
            cnt += 1
    ans = max(ans, cnt)
print(len(T) - ans)
import sys 

string1 = str(input())
string2 = str(input())

n, m = len(string2), len(string1) 

ans = sys.maxsize 
for i in range(m - n + 1): 
    minRemovedChar = 0 
    for j in range(n): 
        if (string2[j] != string1[i + j]): 
            minRemovedChar += 1
    ans = min(minRemovedChar, ans) 

print(ans)
s=input()
t=input()
ans=1000
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(ans,cnt)
print(ans)
#abc177_B_1
list_1 = list(str(input()))
list_2 = list(str(input()))

int_agg_count_max_diff = 10000
for i in range(len(list_1) - len(list_2) + 1):
  list_1_tmp = list_1[i:i+len(list_2)]
  
  int_count_max_diff = 0
  for j in range(len(list_2)):
    if list_1_tmp[j] != list_2[j]:
      int_count_max_diff = int_count_max_diff + 1
  if int_agg_count_max_diff > int_count_max_diff:
    int_agg_count_max_diff = int_count_max_diff
print(int_agg_count_max_diff)
S = input()
T = input()

counter = 0
for i in range(len(S)):
    second = 0
    group = S[i:i+len(T)]
    if len(group) < len(T):
        break
    for j in range(len(T)):
        if T[j] != group[j]:
            second += 1
    if counter == 0:
        counter = second
    elif second < counter:
        counter = second


print(counter)
s=input()
t=input()
ls=len(s)
lt=len(t)
a=[0]*(ls-lt+1)

for i in range(ls-lt+1):
    for j in range(lt):
        if s[i+j]!=t[j]:
            a[i]+=1

print(min(a))
s, t = open(0).read().split()
n, m = len(s), len(t)
a = 2000
for i in range(n - m + 1):
    b = 0
    for j in range(m):
        b += s[i + j] != t[j]
    a = min(a, b)
print(a)
s = input()
t = input()
S,T = len(s),len(t)
ans = T
for i in range(S-T+1):
    tmp = [c1!=c2 for c1,c2 in zip(s[i:i+T],t)].count(True)
    ans = min(ans,tmp)
print(ans)
S = str(input())
T = str(input())

Slen = len(S)
Tlen = len(T)
diff = Slen - Tlen

ans = [0] * (diff+1)
for i in range(diff+1):
	S_i = i
	for j in range(Tlen):
		if S[S_i] != T[j]:
			ans[i] = ans[i] + 1
		S_i += 1
min_ans = min(ans)
print(min_ans)
def main():
    s = input()
    t = input()
    len_s = len(s)
    len_t = len(t)

    min_count = len_t
    for i in range(len_s-len_t+1):
        count = len_t
        for j in range(len_t):
            if s[i+j] == t[j]:
                count -= 1
        if count < min_count:
            min_count = count
    return min_count


if __name__ == "__main__":
    print(main())
s = input()
t = input()

cnt = 0

for i in range(len(s) - len(t)+1):
    tmp = 0
    for j in range(len(t)):
        if s[i+j] == t[j]:
            tmp += 1
    
    if cnt < tmp:
        cnt = tmp

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

ans = len(t)
if len(s) == len(t):
    icchi = 0
    for i in range(len(s)):
        if s[i] == t[i]:
            icchi += 1
    ans = len(t)-icchi
else:
    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 = input()
t = input()
numlist = []
for i in range(len(s)-len(t)+1):
    a = s[i:i+len(t)]
    count = 0
    for j in range(len(t)):
        if a[j] != t[j]:
            count += 1
    numlist.append(count)
print(min(numlist))