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

count = len(t)

for i in range(0, len(s) - len(t) + 1):
    x = s[i : i + len(t)]
    cnt = 0
    for i in range(len(t)):
        if t[i] != x[i]:
            cnt += 1
    if count >= cnt:
        count = cnt

print(count)
s=input()
t=input()
m=1000
for i in range(len(s)-len(t)+1):
  mm=0
  for j in range(len(t)):
    if s[i+j]!=t[j]:
      mm+=1
  m=min(mm,m)
print(m)
s = input()
t = input()
n = len(s)
m = len(t)

ans = 0
for i in range(n):
    if n < i+m:
        continue
    x = s[i:i+m]
    cnt = 0
    for a, b in zip(x, t):
        if a == b:
            cnt += 1
    if ans < cnt:
        ans = cnt
print(m-ans)
S = input()
T = input()

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

    if cnt > m_cnt:
        m_cnt = cnt
    cnt = 0

print(len(T) - m_cnt)
S = input()
T = input()
s = len(S)
t = len(T)

ans = 1000

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

print(ans)
#模範解答 tの文字列の数に絞って全探索を掛ける
S = input()
T = input()

N = len(T)

s_list = []
for i in range(len(S) - N + 1):
    s = S[i: i + N]
    s_list.append(s)

answer = N
for s in s_list:
    counter = 0
    for i in range(N):
        if s[i] != T[i]:
            counter += 1

    answer = min(answer, counter)

print(answer)
s = input()
t = input()

ans = 10 ** 10
for i in range(len(s) - len(t) + 1):
    cnt = 0
    for j in range(len(t)):
        if t[j] != s[i + j]:
            cnt += 1
    ans = min(cnt, ans)
print(ans)
S=input()
T=input()
NS=len(S)
NT=len(T)
ans=pow(10,9)
for n in range(NS-NT):
    suuji=0
    for m in range(NT):
        if S[n+m]!=T[m]:
            suuji+=1
    ans=min(ans,suuji)
if NS==NT:
    suuji=0
    for n in range(NS):
        if S[n]!=T[n]:
            suuji+=1
    ans=min(suuji,ans)
print(ans)
S=input()
T=input()
x=len(S)
y=len(T)
l=[]
for i in range(x-(y-1)):
    s=0
    for j in range(y):
        if S[j+i]==T[j]:
            s+=1
    l.append(y-s)
print(min(l))
S = input()
T = input()
N, M = len(S), len(T)
ma = 0
for i in range(N-M+1):
    c = 0
    for j in range(M):
        if S[i+j] == T[j]:
            c += 1
    ma = max(ma, c)

print(M - ma)
S=input();T=input()
N=len(S);NP=len(T);M=len(T)
for i in range(N-M+1):
  cnt=0
  for j in range(M):
    if T[j]==S[j+i]:cnt+=1
  if NP>M-cnt: NP=M-cnt
print(NP)
S=input()
T=input()
lens=len(S)
lent=len(T)

ans=0
for i in range(lens-lent+1):
    tmp=0
    for j in range(lent):
        if S[i+j]==T[j]:
            tmp+=1
        if tmp>ans:
            ans=tmp

print(lent-ans)
import sys
def minimumchar(s1,s2):
	n,m=len(s1),len(s2)
	ans=sys.maxsize
	for i in range(m-n+1):
		minRemovedChar=0
		for j in range(n):
			if (s1[j]!=s2[i+j]):
				minRemovedChar+=1
		ans=min(minRemovedChar,ans)
	return ans
	
s2=input()
s1=input()

print(minimumchar(s1,s2))
import sys

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

ans = lt
for i in range(ls -lt + 1):
  tmp = lt
  for j in range(lt):
    if s[i + j] == t[j]:
      tmp -= 1
  ans = min(ans, tmp)
  if ans == 0:
    print(0)
    sys.exit()
  
print(ans)
a = input()
b = input()
mini = len(b)
if a == b:
  print(0)
  exit(0)
for s in range(len(a) - len(b) + 1):
  c = 0
  for i, j in zip(a[s:s + len(b)], b):
    if i != j:
      c += 1
  mini = min([mini, c])
print(mini)
s=input()
t=input()
lt=len(t)
x=lt
for i in range(len(s)-lt+1):
  a=0
  for j in range(lt):
    if s[i+j]!=t[j]:
      a+=1
  x=min(x,a)
print(x)
S = input()
T = input()

ans = 10 ** 5

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

for i in range(sl-tl+1):
    cnt = 0
    for j in range(tl):
        if S[i+j] == T[j]:
            continue
        cnt += 1
    ans = min(ans, cnt)

print(ans)
S = input()
T = input()
ans = 0
for i in range(len(S)-len(T)+1):
    s = S[i:i+len(T)]
    num = 0
    for j in range(len(T)):
        if s[j] == T[j]:
            num += 1
    if num>ans:
        ans = num
print(len(T)-ans)
s = input()
t = input()
ans = len(t)
for i in range(len(s) - len(t) + 1):
    ans = min(ans, sum(si != ti for si, ti in zip(s[i:], t)))
print(ans)
S = input()
T = input()

ans = len(T)

for offset in range(len(S) - len(T) + 1):
    ans_offset = 0
    for i in range(len(T)):
        if T[i] != S[offset + i]:
            ans_offset += 1

    ans = min(ans, ans_offset)

print(ans)
def comp(a,b):
    s = 0
    for i,j in zip(a,b):
        if not i == j:
            s += 1
    return s
 
s = input()
t = input()
ans = len(t)
 
for i in range(len(s) - len(t) + 1):
    score = comp(s[i:i+len(t)],t)
    if score == 0:
        ans = score
        break
    if ans > score:
        ans = score
 
print(ans)
S = list(str(input()))
T = list(str(input()))

l = len(S) - len(T)
f = len(T)

for i in range(l+1):
    temp = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            temp += 1
    if f > temp:
        f = temp

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

Nmax = len(T)
for i in range(len(S)-len(T)+1):
    diff = 0
    for j in range(len(T)):
        if(S[i+j] != T[j]):
            diff += 1

    Nmax = min(diff, Nmax)

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

print(len(t)-maxans)
S = input()
T = input()
Sn = len(S)
Tn = len(T)
ans = 0

for i in range(Sn-Tn+1):
    M = 0
    for j, k in zip(S[i:], T):
        if j == k:
            M += 1
    
    if M > ans:
        ans = M

print(Tn - ans)
xmoji=input()
ymoji=input()

x=len(xmoji)
y=len(ymoji)
tempmin = 0
for i in range(0,x-y+1):
    xmin=xmoji[i:i+y]
    samenum=0
    for j in range(0,y):
        if(xmin[j]==ymoji[j]):
            samenum+=1
    if(tempmin<samenum):
        tempmin = samenum
print(y-tempmin)
s = input()
t = input()

sl = len(s)
tl = len(t)

ans = tl
def check(t, s):
    temp = 0
    for i in range(len(t)):
        if t[i] != s[i]:
            temp += 1
        else:
            pass
    return temp
for i in range(sl-tl+1):
    if ans > check(t,s[i:i+tl]):
        ans = check(t,s[i:i+tl])
    else:
        pass
print(ans)
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

#input = sys.stdin.readline

########################################


s = input()
t = input()
n = len(s)
m = len(t)
ans = -float("inf")
for i in range(n-m+1):
	temp = 0
	for j in range(i,i+m):
	#	print("!!",i,s[j],t[j-i])
		if t[j-i]==s[j]:
			temp+=1
	#print(i,temp)
	ans = max(temp , ans)
print(m - ans)
s = list(input())
t = list(input())
ans = len(t)

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

    ans = min(ans, tmp)

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

maxc=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
    if maxc<count:
        maxc=count
print(int(len(T)-maxc))
s = input()
t = input()
ans = 0
ls = len(s)
lt = len(t)
for i in range(ls-lt+1):
    tmp = 0
    for j in range(lt):
        if s[i+j] == t[j]:
            tmp+=1
    ans = max(ans,tmp)
print(lt-ans)
s = input()
t = input()

ans_list = []
end = len(s) - len(t) + 1
for i in range(end):
    word = s[i:i+len(t)]
    tmp = 0
    for j in range(len(t)):
        if t[j] != word[j]:
            tmp += 1
    ans_list.append(tmp)

ans_list.sort()
ans = ans_list[0]

print(ans)
S = input()
T = input()
ans = 1001
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
    ans = min(ans, c)
print(ans)
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)
import math

s = input()
t = input()

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

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

ans = 10000
for i in range(len(s)-len(t)+1):
  score = 0
  for j in range(len(t)):
    if s[i+j] != t[j]:
      score += 1
  ans = min(ans, score)
  
print(ans)
s = input()
t = input()
min_count = len(s)
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 min_count > count:
        min_count = count
print(min_count)
import sys

input = sys.stdin.readline



S = input()
T = input()

S = S.replace('\n','')
T = T.replace('\n','')

s_list = list(S)
t_list = list(T)

itti = 0
min_count = 10**5
for i in range(len(s_list)):
    if i + len(t_list) > len(s_list):
        break
    count = 0
    for j in range(len(t_list)):
        if not s_list[i+j] == t_list[j]:
            count += 1
    min_count = min(count,min_count)

print(min_count)
S = input()
T = input()

a = 0
ans = len(T)
c = len(T)


for i in range(len(S)-len(T)+1):
    b = 0
    c = len(T)
    for j in T:
        if S[i+b] == j:
            c -= 1
        b += 1
    else:
        if ans > c:
            ans = c
        
print(ans)
S = input()
T = input()

length = len(T)
index = 0
minimum = 1000
count = 0
for i in range(len(S)):
    if length+index > len(S):
        break
    bubun = S[index:length+index]
    for s, t in zip(bubun, T):
        if s != t:
            count += 1
    minimum = min(minimum, count)
    index += 1
    count = 0

print(minimum)
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    s = input()
    t = input()
    hoge = 10000
    let = len(t)
    les = len(s)
    ans = 10000
    for i in range(les-let+1):
        hoge = s[i:i+let]
        piyo = 0
        for j, k in zip(hoge,t):
            if j != k:
                piyo += 1
        if piyo < ans:
            ans = piyo
    print(ans)
    return 0

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

n = len(s)
m = len(t)

res = m

for i in range(n-m+1):
    curr = 0
    for j in range(m):
        if t[j]!=s[i+j]:
            curr+=1
    res = min(res, curr)

print(res)
s = input()
t = input()
ans = len(t)
for i in range(len(s)):
    if len(t)> len(s)-i:
        break
    else:
        cnt=0
        for j in range(len(t)):
            if s[i+j]==t[j]:
                cnt+=1
    ans=min(ans,len(t)-cnt)
print(ans)
string1 = input()
string2 = input()

n, m = len(string1), len(string2)
best = float("inf")
for i in range(n - m + 1):
  current = string1[i:i+m]
  differences = 0
  for i in range(m):
    if current[i] != string2[i]:
      differences += 1
  best = min(differences, best)

if best == float("inf"):
  print(0)
else:
  print(best)
s = input()
t = input()
ans = 1000

for idx in range(len(t), len(s)+1):
    tmp = 0
    for s_s, t_s in zip(list(s[idx-len(t):idx]), list(t)):
        if not s_s == t_s:
            tmp += 1
    if ans > tmp:
        ans = tmp

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

ans = 10000

for i in range(len(t)-len(s)+1):
    tmpans = 0
    for j in range(len(s)):
        if s[j] != t[i+j]:
            tmpans += 1
    if ans > tmpans:
        ans = tmpans

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

tt = t

max_count = 0
while True:
    count = 0
    for i in range(len(tt)):
        if s[i] == tt[i]:
            count += 1 
    # print(count)
    max_count = max(max_count, count)
    
    # print(f"{len(s)} {len(t)}")
    if len(s) == len(tt):
        break
    
    tt = ' ' + tt
    
print(len(t) - max_count)
S = input()
T = input()
list_s = list(S)
list_t = list(T)
A = []
for i in range(len(list_s)-len(list_t)+1):
    t = i
    count = 0
    for j in range(len(list_t)):
        if list_t[j] == list_s[t]:
            t +=1
            count +=1
        else:
            t +=1
    A.append(count)
print(len(list_t) - max(A))
s = input()
t = input()

sl = len(s)
tl = len(t)

ans = tl

for i in range(sl):
    if i < sl - tl + 1:
        ss = s[i:i+tl]
        num = 0
        for j in range(tl):
            if ss[j] != t[j]:
                num += 1
        if num < ans:
            ans = num

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

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

count = []
for i in range(len(S) - len(T) + 1):
    match_count = 0
    for s, t in zip(S[i:i+len(T)], T):
        if s in t:
            match_count += 1
    count.append(match_count)

print(len(T) - max(count))
s = list(input())
t = list(input())
ans = 100000

for i in range(len(s) - (len(t) - 1)):
    diff = 0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            diff += 1
    ans = min(ans, diff)
print(ans)
#a,b,c = list(map(int,input().split()))

s = input().rstrip()
t = input().rstrip()

best = 99999999

for i in range(len(s) - len(t) + 1):
  tmp = 0
  for j in range(len(t)):
    if t[j] != s[j+i]:
      tmp += 1
  best = min(best,tmp)
  
print(best)
s = str(input())
t = str(input())
n = len(s)
m = len(t)
ans = float("inf")
for i in range(n-m+1):
  si = s[i:i+m]
  c = 0
  for j in range(m):
    if si[j] != t[j]:
      c += 1
  if c < ans:
    ans = c
print(ans)
S = input()
T = input()

cnt = 0
best = 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 > best:
        best = cnt

print(len(T) - best)
def resolve():
    S = input()
    T = input()
    sl = len(S)
    tl = len(T)
    mn = 10000
    for i in range(sl - tl+1):
        count = 0
        #print(T,S[i:i+tl])
        for j,k in zip(T,S[i:i+tl]):
            if j!=k:
                count+=1
        
        mn=min(mn,count)
    print(mn)
resolve()
S = str(input())
T = str(input())

N = 10000
for i in range(len(S) - len(T)+ 1):
  s =S[i:(i+len(T))]
  n =0
  for k in range(len(T)):
    if s[k] !=  T[k]:
      n+= 1
  N  = min(N, n)
  
print(N)
S =input()
T = input()
n = len(S)-len(T)+1
count = []

for i in range(n):
  c =0
  for p in range(len(T)):
    if S[i+p] != T[p]:
      c += 1
  count.append(c)
  
print(min(count))
S = input()
T = input()
l = []
for i in range(len(S)-len(T) + 1): 
        c = 0 
        s = S[i:i + len(T)]
        for j in range(len(T)):
                if s[j] != T[j]:
                        c += 1
        l.append(c)
print(min(l))
s = input()
t = input()
slen = len(s)
tlen = len(t)
ans = 10**20
temp = 0

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

maxcount = 0
for i in range(len(s) - len(t) + 1):
  ss = s[i:len(t) + i]
  count = 0
  for j in range(len(t)):
    if t[j] == ss[j]:
      count += 1
  
  if count > maxcount:
    maxcount = count

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

def compare(a,b):
    r = 0
    for i in range(len(a)):
        if a[i] != b[i]:
            r += 1
    return r

res = 10000
for i in range(len(s)-len(t)+1):
    res = min(compare(s[i:i+len(t)], t), res)

print(res)
s, t = input(), input()

len_t = len(t)

dif = 1001
for i in range(len(s)-len_t+1):
    dif = min(dif, sum([x !=  y for x, y in zip(s[i:i+len_t], t)]))

print(dif)
# -*- coding: utf-8 -*-


def main():
    s = input()
    n = len(s)
    t = input()
    m = len(t)
    ans = float('inf')

    for i in range(n - m + 1):
        u = s[i:i + m]

        count = 0

        for ui, ti in zip(u, t):
            if ui != ti:
                count += 1

        ans = min(ans, count)

    print(ans)


if __name__ == '__main__':
    main()
N = input()
S = input()
a = 0
nums = list(N[i:i+len(S)] for i in range(len(N)) if i+len(S)-1 < len(N))
nums_max  = 0
for i in nums:
  tmp = 0
  for j in range(len(S)):
    if i[j] == S[j]:
      tmp += 1
  if nums_max < tmp:
    nums_max = tmp
print(len(S)-nums_max)
s = input()
t = input()
min_num = len(t)
tbd = 0
for i in range(0,len(s)-len(t)+1):
    for j in range(len(t)):
        if s[i:i+len(t)][j] != t[j]:
            tbd += 1
    if tbd <= min_num:
        min_num = tbd
    tbd = 0

print(min_num)
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, T = input(), input()

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

print(ans)
S=list(input())
T=list(input())
def ask_true(a,b):
    if a == b:
        return True
    else:
        return False
d=10000
for i in range(len(S)-len(T)+1):
    sum_=0
    for j in range(len(T)):
        if ask_true(S[i+j],T[j]):
            pass
        else:
            sum_ += 1
    d=min(sum_,d)
print(d)
def compare(ar1,ar2):
    count = 0
    for i in range(len(ar1)):
        if ar1[i] != ar2[i]:
            count+=1
    return count

s = input()
t = input()
lowest = len(t)
for i in range(len(s)-len(t)+1):
    res = compare(t,s[i:i+len(t)])
    if res < lowest:
        lowest = res
print(lowest)
S = input()
T = input()

min_cnt = 9999999999
for i in range(0, len(S) - len(T)+1):
    s = S[i: i + len(T)]
    cnt = 0
    for m, n in zip(s, T):
        if m != n:
            cnt +=1
    min_cnt = min(min_cnt, cnt)

print(min_cnt)
S=input()
LS=len(S)
T=input()
LT=len(T)

ans=LT
for i in range(LS-LT+1):
  tmp=0
  for j in range(LT):
    if S[i+j]!=T[j]:
      tmp+=1
  #print(tmp)
  ans=min(tmp,ans)
  #tmp=0
print(ans)
S = input().strip()
T = input().strip()
k = len(T)
dmin = len(S)
for i in range(len(S)-k+1):
    cnt = 0
    for j in range(k):
        if S[i+j]!=T[j]:
            cnt += 1
    dmin = min(dmin,cnt)
print(dmin)
s=input()
t=input()
anses=[]
for i in range(0,len(s)-len(t)+1,1):
    cnt=0
    for j in range(len(t)):
        if s[i+j]==t[j]:
            cnt+=1
    anses.append(cnt)
print(len(t)-max(anses))
s=input()
t=input()
ans=10**8
n=len(s);m=len(t)
for i in range(n-m+1):
	cnt=0
	for j in range(m):
		if s[i+j]!=t[j]:
			cnt+=1
	ans=min(ans,cnt)
print(ans)
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 + len(T):
      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()
ans = len(T)
for i in range(len(S)-len(T)+1):
  c = 0
  for j in range(len(T)):
    if T[j] != S[i+j]:
      c+=1
  ans = min(c,ans)
print(ans)
s=input()
t=input()

l=len(s)-len(t)
mindiff=float("inf")
for i in range(l+1):
  ss=s[i:i+len(t)]
  cnt=0
  for j,c in enumerate(t):
    if ss[j]!=c:
      cnt+=1
  mindiff=min(mindiff,cnt)
print(mindiff)
S = input ()
T = input ()
X = len(T)
for i in range (len(S)-len(T)+1):
  x = 0
  for j in range (len(T)):
    if T[j] != S[i+j]:
      x += 1
  if X > x:
    X = x
print (X)
s = str(input())
t = str(input())
n = len(s)
m = len(t)
ans = 10000
for i in range(n-m+1):
    ans_temp = 0
    for j in range(m):
        if s[i+j] != t[j]:
            ans_temp += 1
    ans = min(ans, ans_temp)
print(ans)
S = input()
T = input()
len_s = len(S)
len_t = len(T)

ans = 0
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
    ans = max(ans,c)
print(len_t-ans)
S = input()
T = input()

result = float('inf')
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
    result = min(result, c)
print(result)
s = input()
t = input()
ans = 10**9
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
    ans = min(ans, c)
print(ans)
s = input()
t = input()

minCount = len(t)
l = len(s) - len(t) + 1
for i in range(l):
    count = 0
    for n in range(len(t)):
        if s[i+n] != t[n]:
            count+=1
    if count < minCount:
        minCount = count
print(minCount)
import numpy as np
import sys

S = input()
T = input()

counter = 0
max_counter = 0

for i in range(len(S) - len(T) + 1):
    for j in range(len(T)):
        if S[j+i] == T[j]:
            counter = counter + 1
    if counter > max_counter:
        max_counter = counter
    # print(counter)
    # print('max = ' + str(max_counter))
    counter = 0

print(int(len(T)) - int(max_counter))
S = input()
T = input()
ans = 10 ** 9

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()
ma = 0
for i in range(len(S)-len(T)+1):
    Ssub = S[i:i+len(T)]
    match = 0
    for j in range(len(T)):
        if Ssub[j] == T[j]:
            match += 1
    if ma < match:
        ma = match
print(len(T)-ma)
from itertools import combinations
import math
S = input()
T = input()
#N = int(input())
#C = input()
#D, T, S=map(int,input().split())
#C = []
#for i in range(N):
#    C.append(list(map(int,input().split())))
c = 0
for i in range(len(S)-(len(T)-1)):
    cc = 0
    for t in range(i, i+len(T)):
        if S[t] == T[t-i]:
            cc += 1
    if c<cc:
        c=cc
print(len(T)-c)
s, t = [input() for i in range(2)]
c = []
for i in range(len(s) - len(t) + 1):
  d = len(t)
  for a, b in zip(s[i:], t):
    if a == b:
      d -= 1
  c.append(d)
print(min(c))
import sys
input = sys.stdin.readline
from collections import *

def calc(i):
    d = 0
    
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            d += 1
    
    return d
    
S = input()[:-1]
T = input()[:-1]
ans = 10**18

for i in range(len(S)-len(T)+1):
    ans = min(ans, calc(i))

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

result = 10000
for i in range(len(S) - len(T) + 1):
  # print(i)
  start = i
  count = 0
  for j in range(len(T)):
    if T[j] != S[i + j]:
      count += 1
  result = min(count, result)

print(result)
def Qb():
    s = input()
    t = input()

    ans = len(t)
    for v in range(len(s) - len(t) + 1):
        a = [t[i] != x for i, x in enumerate(s[v:len(t)+v])]
        if sum(a) < ans:
            ans = sum(a)
    print(ans)


if __name__ == '__main__':
    Qb()
S = input().rstrip()
T = input().rstrip()

s = len(S)
t = len(T)
u = s-t+1

A = []
for i in range(u):
  count = 0
  for j in range(t):
    if T[j] != S[i+j]:
      count += 1
  A.append(count)
print(min(A))
s = input()
t = input()
ans = len(t)
if len(s) == len(t):
    for i in range(len(t)):
        if s[i] == t[i]:
            ans -= 1
else:
    for i in range(len(s)-len(t)):
        min_ans = 0
        s1 = s[i:len(t)+i]
        for j in range(len(t)):
            if s1[j] != t[j]:
                min_ans += 1
        ans = min(ans,min_ans)
print(ans)
S = list(input())
T = list(input())

def diff(s,t):
    count = 0
    #print(s,t)
    for i in range(len(t)):
        if s[i]!=t[i]:
            count+=1
    #print(count)
    return count
min_c = diff(S,T)

for i in range(len(S)-len(T)):
    d = diff(S[i:],T)
    #print(d)
    if d<min_c:
        min_c = d
print(min_c)
S = input()
T = input()

n = len(T)
res = n
for i in range(len(S) - n + 1):
    count = 0
    for c1, c2 in zip(S[i: i + n], T):
        if c1 != c2:
            count += 1
    res = min(count, res)
print(res)
S = input()
T = input()
 
min = len(T)
for t in range(len(S) - len(T)+1):
    tmp = 0
    for i in range(len(T)):
        if S[i+t] != T[i]:
            tmp+=1
    
    if tmp < min:
        min = tmp
 
print(min)