peterverebics/CodeNet_Python_118 huggingface dataset:
S = list(str(input()))
T = list(str(input()))
i = 0
ans = []
len_s = len(S)
len_t = len(T)
while i < len_s-len_t+1:
    cnt = 0
    for ss, tt in zip(S[i:i+len_t], T):
        if ss != tt:
            cnt += 1
    ans.append(cnt)
    i += 1
print(min(ans))
S = list(input())
T = list(input())
ls = len(S)
lt = len(T)
ans = lt
for i in range(ls):
    temp = 0
    if i+lt > ls:
        break
    subS = S[i:i+lt]
    for ss, st in zip(subS, T):
        if ss != st:
            temp += 1
    ans = min(ans, temp)
print(ans)
s=list(input())
t=list(input())
ans=[]

for i in range(len(s)-len(t)+1):
    u=s[i:len(t)+i]
    a=0
    for j in range(len(t)):
        if not t[j-1]==u[j-1]:
            a=a+1
    ans.append(a)
print(min(ans))
#!/usr/bin/env python
# coding: utf-8

# In[15]:


S = input()
T = input()


# In[16]:


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


# In[ ]:
def main():
    ss = list(input())
    ts = list(input())
    n, m = len(ss), len(ts)
    ans = float("inf")
    for i in range(n-m+1):
        ans_temp = 0
        for j in range(m):
            if ss[i+j] != ts[j]:
                ans_temp += 1
        ans = min(ans, ans_temp)
    print(ans)


if __name__ == "__main__":
    main()
s=input()
t=input()
ans=len(t)
for i in range(len(s)-len(t)+1):
	p=s[i:i+len(t)]
	cur = 0
	for j in range(len(t)):
		if t[j] != p[j]:
			cur += 1
	ans=min(ans,cur)
print(ans)
s, t = input(), input()
i, j = 0, 0
longest = 0
for i in range(len(s)-len(t)+1):
    count = sum([s[i+j] == t[j] for j in range(len(t))])
    longest = max(longest, count)
print(len(t)-longest)
S = input()
T = input()

ans = 10000

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

print(ans)
S = list(input())
T = list(input())
L = len(T)
ans = L
for i in range(len(S)-L+1):
    check = 0
    for j in range(L):
        if(S[i+j] != T[j]):
            check += 1
    if(ans > check):
        ans = check
print(ans)
s = input()
t = input()
ans = []
for i in range(len(s)-len(t) + 1):
  s_i = s[i:i+len(t)]
  count_diff = 0
  for t_j, s_j in zip(t, s_i):
    if t_j != s_j:
      count_diff += 1
  ans.append(count_diff)
print(min(ans))
S = input()
T = input()

L = len(S) - len(T) + 1
c = [0 for i in range(L)]
for i in range(L):
    X = S[i:i+len(T)]
    for j in range(len(X)) :
        if X[j] != T[j] :
            c[i] = c[i] + 1
   
ans = min(c)

print(ans)
s = input()
t = input()
c = 0
c_list = []
for i in range(len(s)-len(t)+1):
    #print(s[i:len(t)+i])
    tmp_s = s[i:len(t)+i]
    for j in range(len(t)):
        if(tmp_s[j] == t[j]):
            c += 1
    c_list.append(c)
    c = 0

print(len(t)-max(c_list))
s = list(input())
t = list(input())
max = 0
c = 0
for i in range(len(s) - len(t) + 1):
	for j in range(len(t)):
		if t[j] == (s[i:i+len(t)])[j]:
			c += 1
	if max < c:
		max = c
	c = 0
print(len(t) - max)
import sys
import heapq
from collections import deque
from functools import cmp_to_key
from itertools import combinations
from itertools import permutations
si = sys.stdin.readline
so = sys.stdout.write
sys.setrecursionlimit(10000)


def main():
    s = si()[:-1]
    t = si()[:-1]
    cnt = 1000+1
    for i in range(len(s)-len(t)+1):
        curr = 0
        for j in range(len(t)):
            if s[i+j] != t[j]:
                curr += 1
        cnt = min(cnt, curr)
    print(cnt)


if __name__ == '__main__':
    main()
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()
    ans = INF
    for i in range(len(S) - len(T) + 1):
        ans = min(ans, sum(s != t for s, t in zip(S[i : i + len(T)], T)))
    print(ans)
resolve()
S = input()
T = input()

match = 0
k = 0
result = 0
for i in range(len(S)-len(T)+1) :
    k = i # start
    match = 0
    for j in range(len(T)) :
        #print(T[j],S[k])
        if T[j] == S[k] :
            match = match + 1
        k += 1
    result = max(result,match)
#print(result)
print(len(T) - result)
s=input()
t=input()
l=len(s)
l2=len(t)
ans=1000000
for i in range(l-l2+1):
	curr=0
	for j in range(i,i+l2):
		if(s[j]!=t[j-i]):
			curr+=1
	if(curr<ans):
		ans=curr
print(ans)
S = input()
T = input()

L = len(T)
ans = 0

for i in range(len(S)-L+1):
    cnt = 0
    for j in range(L):
        
        if S[i+j] == T[j]:
            cnt += 1
        ans = max(ans,cnt)
        
print(L-ans)
slist=list(input())
tlist=list(input())
s=len(slist)
t=len(tlist)
kazu=s-t+1
ans=10000000000

for i in range(kazu):
    kari=[]
    an=0
    for j in range(i,i+t):
        kari.append(slist[j])
    for k in range(t):
        if tlist[k]!=kari[k]:
            an+=1
    if ans>an:
        ans=an

print(ans)
s=input()
t=input()
n=len(s);k=len(t)
an=k
for i in range(n-k+1):
  a=s[i:i+k]
  ct=0
  for j in range(k):
    if a[j]!=t[j]:
      ct+=1
  an=min(an,ct)
print(an)
S=input()
T=input()

def diff(s,t):
  out=0
  for i in range(len(s)):
    if s[i]!=t[i]:
      out+=1
  return out

ans=10000
for i in range(len(S)-len(T)+1):
  tmp = diff(S[i:i+len(T)], T)
  ans = min(ans,tmp)
  
print(ans)
s = input()
t = input()
most = float("inf")
for i in range(len(s)-len(t)+1):
    count = 0
    for j in range(i,i+len(t)):
        if s[j] != t[j-i]:
            count += 1
    most = min(most,count)
print(most)
s=input()
t=input()
n=len(s)
m=len(t)
ans=0
for i in range(n-m+1):
  c=0
  for j in range(m):
    if s[i+j]==t[j]:
      c+=1
  ans=max(c,ans)
print(m-ans)
#!/usr/bin/python3
# -*- coding: utf-8 -*-
s = input()
t = input()
min_count = 1000
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)
    if min_count == 0:
        break
print(min_count)
s = input()
t = input()

ans = 10000
for i in range(len(s)-len(t)+1):
    bubun = s[i:i+len(t)]
    okikae = 0
    for j in range(len(t)):
        if bubun[j] != t[j]:
            okikae += 1
    if okikae <= ans:
        ans = okikae
print(ans)
def main():
    s = input()
    t = input()
    ans = 100000
    for i in range(len(s) - len(t) + 1):
        sub = s[i:i+len(t)]
        tmp = 0
        for j in range(len(sub)):
            if sub[j] != t[j]:
                tmp += 1
        ans = min([ans, tmp])
    print(ans)


if __name__ == '__main__':
    main()
# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

S = input()
T = input()
lenS = len(S)
lenT = len(T)

difmin = float("inf")
for si in range(lenS - lenT + 1):
    dif = 0
    for s, t in zip(S[si:], T):
        if s != t:
            dif += 1
    difmin = min(difmin, dif)

print(difmin)
S = input()
T = input()
s = len(S)
t = len(T)

def checkCommonLength(a: str, b: str) -> int:
    l = len(a)
    count = 0
    for i in range(l):
        if a[i] == b[i]:
            count += 1
    return count

max_val = 0
for i in range(s):
    if i + t <= s:
        testStr = S[i : i + t]
        #print(testStr)
        max_val = max(max_val, checkCommonLength(S[i : i + t], T))

print(t - max_val)
S=input()
T=input()
A=[]
for i in range(len(S)-len(T)+1):
    s=S[i:i+len(T)]
    t=[T[j] for j in range(len(T)) if s[j] != T[j]]
    A.append(len(t))
print(min(A))
S = list(input())
T = list(input())

lenS = len(S)
lenT = len(T)

match = 0
for i in range(lenS - lenT + 1):
    cnt = 0
    for j in range(lenT):
        if S[i + j] == T[j]:
            cnt += 1
    match = max(match, cnt)

print(lenT - match)
s = input()
t = input()

diff_min = len(t)
while len(s) >= len(t):
    diff = 0
    for i in range(len(t)):
        if s[i] != t[i]:
            diff += 1
    diff_min = min(diff_min, diff)
    s = s[1:]
print(diff_min)
S = input()
T = input()

l = []
if len(S) != len(T):
  for i in range(len(S) - len(T)):
    cnt = 0
    for j in range(len(T)):
      if T[j] != S[i+j]:
        cnt += 1
    l.append(cnt)
  print(min(l))
else:
  cnt = 0
  for i in range(len(S)):
    if T[i] != S[i]:
      cnt += 1
  print(cnt)
s = input()
t = input()
ans = 0
A = []
for i in range(len(s)-len(t)+1):
    s_i = s[i:i+len(t)+1]
    count = 0
    for j in range(len(t)):
        if s_i[j] == t[j]:
            count += 1
    A.append(count)

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

ans = 9999
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 tmp < ans:
    ans = tmp

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

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

min_count = t
for i in range(s - t + 1):
    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()
ls = len(s)
lt = len(t)
mi = 10**6
for i in range(ls-lt+1):
    s1 = s[i:i+lt]
    count = 0
    for j in range(lt):
        if s1[j]!=t[j]:
            count += 1
    mi = min(mi,count)
print(mi)
S = input()
T = input()

lenS = len(S)
lenT = len(T)
chgCnt = 0

for j in range(lenS - lenT + 1):
  sameCnt = 0
  for i in range(lenT):
    if S[j + i] == T[i]:
      sameCnt += 1
  if chgCnt < sameCnt:
    chgCnt = sameCnt
    
print(lenT - chgCnt)
a=b=0
for i in range(len(s:=input())-len(t:=input())+1):
  for j,c in enumerate(t):b+=(s[i+j]==c)
  a=max(a,b);b=0
print(len(t)-a)
S=input()
T=input()

ans=10000

for i in range(len(S)-len(T)+1):
  score=0
  U=S[i:i+len(T)]#Sのi文字目から{i+len(T)}文字目までがU->部分文字列を抜き出している
  for j in range(len(T)):
    if U[j] != T[j]:
      score += 1
  ans = min(ans, score)

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

minimum = math.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
    minimum = min(minimum,cnt)
print(minimum)
S = list(input())
T = list(input())

i = 0
ans =[]

while i + len(T) <= len(S):
    n = 0
    for s, t in zip(S[i:i+len(T)], T):
        if s != t:
            n += 1
    ans.append(n)
    i += 1

print(min(ans))
# p = list(map(int, input().split()))
# a, b, c = map(int, input().split())
# n = int(input())
# s = input()
# print(i, end=" ")
s = input()
t = input()
ans = len(t)

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

    ans = min(ans, dif)
print(ans)
s = input()
t = input()
ls = len(s)
lt = len(t)
r = lt
for i in range(ls - lt + 1):
    tmp = 0
    for j in range(lt):
        if s[i + j] != t[j]: tmp += 1
    r = min(r, tmp)
print(r)
s=input()
t = input()
maxi = 0

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

ans = len(t)

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

def c(s, t):
  #print(s)
  r = 0
  for i in range(n):
    if s[i] == t[i]:
      r += 1
  return n - r

ans = n
for i in range( len(S) - n + 1):
  temp = c(S[i:i+n],T)
  ans = min( ans, temp)

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

ans = len(T)
for i in range(len(S) - len(T) + 1):
    v = 0
    for j in range(len(T)):
        # print(i, j)
        if S[i+j] != T[j]:
            v += 1
    # print(i, v)
    ans = min(ans, v)
print(ans)
S = input()
T = input()
ls = len(S)
lt = len(T)


m = 0
for i in range(ls-lt+1):
    tmp = S[i:i+lt]
    cnt = 0
    for idx,j in enumerate(tmp):
        if T[idx]==j:
            cnt+=1
    m = max(cnt,m)

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

for i in range(len(s) - len(t) +1):
    curr = len(t)
    for j in range(len(t)):
        if s[i+j] == t[j]:
            curr -= 1
    if curr < ans:
        ans = curr

print(ans)
def main():
    s = input()
    t = input()
    l = len(t)

    minCount = l

    for i in range(len(s)-l+1):
        s1 = s[i:i+l]
        count = 0
        for j in range(len(s1)):
            if s1[j] != t[j]:
                count += 1
        minCount = min(minCount, count)

    print(minCount); 
    


if __name__ == '__main__':
    main();
S=input()
T=input()
SL=len(S)
TL=len(T)

def match(x,y):
  c=0
  for i in range(TL):
    if x[i]==y[i]:
      c+=1
  return c

max_match=0
for j in range(SL-TL+1):
  m=match(S[j:],T)
  max_match=max(max_match,m)

print("{}".format(TL-max_match))
S = input()
T = input()

ans = float("Inf")

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

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

lens = len(s)
lent = len(t)

chk = []
for i in range(lens-lent+1):
    chk_sum = 0
    tmp = s[i:i+lens]
    for j in range(lent):
        if tmp[j] == t[j]:
            chk_sum += 1
    chk.append(chk_sum)
#print (chk)
print(lent - max(chk))
s = input()
t = input()
ans = 1e9
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 = len(t)
for i in range(len(s)-len(t)+1):
         tmp = len(t)
         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()

min_diff=len(T)
for i in range(len(S)-len(T)+1):
    diff=len(T)
    for j in range(len(T)):
        if T[j]==S[i+j]:
            diff -= 1
    if diff<min_diff:
        min_diff = diff
ans = min_diff
print(ans)
from sys import exit
import math
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

s = input()
t = input()

ans = len(t)
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()
sl = len(s)
tl = len(t)
d = sl -tl
ans = tl
for i in range(d + 1):
  tmp = 0
  for j in range(tl):
    if s[i + j] != t[j]:
      tmp += 1
  ans = min(ans, tmp)
print(ans)
s = input()
t = input()

ans = 1001
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 = min(ans, count)
print(ans)
s = input()
t = input()

num = 0;
cnt = 0
min = len(t)
for i in range(len(s)-len(t)+1):
    ss = s[num:num+len(t)]
    for x,y in zip(ss,t):
        if x != y:
            cnt += 1
    if cnt < min:
        min = cnt
    cnt = 0
    num = num +1

print(min)
def distance(s, t):
    return len([1 for (a, b) in zip(s, t) if a != b])

S = input()
T = input()
ans = float('inf')
for i in range(len(S) - len(T) + 1):
    ans = min(ans, distance(T, S[i:i+len(T)]))
print(ans)
S = input()
T = input()

len_s = len(S)
len_t = len(T)


def calc_diff(s1, s2):
    c = 0
    for i in range(len_t):
        if s1[i] != s2[i]:
            c += 1
    return c


ans = float('inf')
for i in range(len_s - len_t + 1):
    sub_s = S[i:i + len_t]
    c = calc_diff(sub_s, T)
    ans = min(ans, c)

print(ans)
import sys

S = sys.stdin.readline().strip()
T = sys.stdin.readline().strip()

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

print(lt - match)
#B
S=input()
T=input()
a=len(S)
b=len(T)
ans=float("inf")
for i in range(0,len(S)-len(T)+1):
    K=S[i:i+len(T)]
    cnt=0
    for j in range(len(K)):
        if K[j]!=T[j]:
            cnt+=1
    ans=min(ans,cnt)
        
print(ans)
s = input()
t = input()

cost = 10**9+7

for i in range(len(s) - len(t)+1):
    c = 0
    sub_s = s[i:i+len(t)]
    for j in range(len(t)):
        if sub_s[j] != t[j]:
            c += 1
    cost = min(c, cost)
print(cost)
from sys import stdin
rs = lambda : stdin.readline().strip()
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))


def main():
    S = rs()
    T = rs()
    ls = len(S)
    lt = len(T)
    print(min([sum([0 if x == y else 1 for x, y in zip(S[i:i + lt], T)]) for i in range(ls - lt + 1)]))

if __name__ == '__main__':
    main()
# B Subtring

S = input()
T = input()

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

print(ans)
def solve(S, T):
    ans = len(T)
    for i in range(len(S) - len(T) + 1):
        diff = 0
        for j in range(len(T)):
            if T[j] != S[i + j]:
                diff += 1
        ans = min(ans, diff)
    print(ans)


if __name__ == "__main__":
    S = input()
    T = input()
    solve(S, T)
S = input()
T = input()

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

print(ans)
S=input()
T=input()
N=len(S)
ans=10**30
for i in range(N-len(T)+1):
    cnt=0
    for j in range(len(T)):
        if S[j+i]!=T[j]:
            cnt+=1
    ans=min(ans,cnt)
print(ans)
#!/usr/bin/env python3
S = input()
T = input()

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

ans = 10 ** 5
for i in range(len(S) - (len(T) - 1)):
    c = len(T)
    for j in range(len(T)):
        if T[j] == S[i + j]:
            c -= 1
    ans = min(ans, c)

print(ans)
import math


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    S = input()
    T = input()
    min_count = math.inf
    for start in range(len(S)-len(T)+1):
        end = start+len(T)
        count = sum(c0 != c1 for c0, c1 in zip(S[start:end], T))
        min_count = min(min_count, count)
    return min_count


if __name__ == '__main__':
    print(solve())
S = input()
T = input()

if T in S:
    print(0)
else:
    matched = 0
    for i in range(len(S)-len(T)+1):
        matched_work = 0
        for j in range(len(T)):
            if T[j] == S[i+j]:
                matched_work += 1
        if matched_work > matched:
            matched = matched_work
    print(len(T)-matched)
def sdiff(s1, s2):
  score = 0
  for i in range(0, len(s2)):
    if s1[i] != s2[i]: score += 1
  return score

S = input()
T = input()
Ans = len(T)

for i in range(0, len(S) - len(T) + 1):
  Ans = min(sdiff(S[i:], T), Ans)

print(Ans)
s=input()
t=input()

ans=1000000
num=len(s)-len(t)
for i in range(num+1):
  r=0
  for j in range(len(t)):
      
    if s[i+j]!=t[j]:
      r+=1
  if r<ans:
      ans=r
print(ans)
S = input()
T = input()
ans = 99999999
for i in range(len(S)-len(T)+1):
    word = S[i:i+len(T)]
    cnt = 0
    for j in range(len(word)):

        if word[j]!=T[j]:
            cnt+=1
    ans = min(ans,cnt)
print(ans)
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 t[j]==s[i+j]:
            cnt+=1
    ans=min(ans,len(t)-cnt)
print(ans)
import sys

input = sys.stdin.readline

s = input()[:-1]
t = input()[:-1]

ans = len(t)
for i in range(len(s) - len(t) + 1):
    tmp = sum(s[i + j] != t[j] for j in range(len(t)))
    ans = min(ans, tmp)
print(ans)
from sys import stdin

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()

INF  = 1005
ans = INF

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

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

n = len(s)
m = len(t)
ans = m
for i in range(n-m+1):
  p = 0
  for j in range(m):
    if s[i+j] != t[j]: p += 1
  if p < ans: ans = p
print(ans)
S = str(input())
T = str(input())
count = 0
max_count = 0

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

ans = len(t)
for i in range(len(s) - len(t) + 1):
    ans_tmp = 0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            ans_tmp += 1
    ans = min(ans, ans_tmp)
print(ans)
import sys
sys.setrecursionlimit(10**7)
def input(): return sys.stdin.readline().rstrip()

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

    ans = len(t)
    for start in range(len(s) - len(t)+1):
        tmp = s[start:(start+len(t))]
        diff = 0
        for i in range(len(t)):
            if tmp[i] != t[i]:
                diff += 1
        ans = min(ans, diff)
    print(ans)

if __name__ == '__main__':
    main()
# import sys
# input = sys.stdin.readline

def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))

s = input()
t = input()
ans = 100000
for i in range(len(s)-len(t)+1):
    u = s[i:i+len(t)]
    cnt = 0
    for j in range(len(t)):
        if u[j] != t[j]:
            cnt += 1
    ans = min(ans,cnt)
print(ans)
S = input()
T = input()
 
def match_num_character(x, y):
  count = 0
  for a, b in zip(x, y):
    if a == b:
      count += 1
      
  return count
 
length = len(T)
max_count = max([match_num_character(S[i:i+length], T) for i in range(1+len(S) - length)])
 
print(length - max_count)
S=input()
T=input()
t = len(T)
s = len(S)
res = t
mid = 0
for i in range(s-t+1):
  mid=0
  for j in range(i,i+t):
    if S[j] == T[j-i]:
      mid += 1
  res = min(t-mid,res)
print(res)
S = input()
T = input()
min = len(S)
for i in range(len(S)-len(T)+1):
    count = 0
    for j in range(len(T)):
        if T[j] != S[i+j]:
            count += 1
    if min >= count:
        min = count

print(min)
S = input()
T = input()
n, m =  len(S), len(T)
ans = n
for i in range(n - m + 1):
    cnt = 0
    subS = S[i: i + m]
    for s, t in zip(subS, T):
        if s != t:
            cnt += 1
    if ans > cnt:
        ans = cnt
print(ans)
s = input()
t = input()
n = len(t)
ans, res = 0, len(s)
for i in range (0, len(s) - len(t) + 1) :
    a = s[i : i + n]
    for i in range(0, n) :
        if (a[i] != t[i]): ans += 1 
    res = min(res, ans)
    ans = 0 
print(res)
s = list(input())
t = list(input())
count = 0
ans = 0
for i in range(len(s)-len(t)+1):
  for j in range(len(t)):
    if s[i+j] == t[j]:
      count += 1
  if count >= ans:
    ans = count
  count=0
print(len(t)-ans)
s=input()
t=input()

l=[False]*len(s)
c=0
m=0
for x in range(len(s)-len(t)+1):
     c=0
     for y in range(len(t)):
          w=s[x:x+len(t)]
          if w[y]==t[y]:c+=1
     m=max(m,c)
print(len(t)-m)
S = input()
T = input()

ans = float('inf')
for i in range(len(S)):
    string = S[i:i + len(T)]
    if len(string) < len(T):
        continue

    score = len([1 for ch_s, ch_t in zip(string, T) if ch_s != ch_t])
    ans = min(ans, score)
print(ans)
def resolve():
    s = input()
    t = input()
    ans = 10**18
    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
        if ans > a:
            ans = a

    print(ans)

resolve()
S = input()
T = input()

ans = 10**18
for l in range(len(S) - len(T) + 1):
    cnt = 0
    for s, t in zip(S[l:], T):
        if s != t:
            cnt += 1
    ans = min(ans, cnt)

print(ans)
# coding:utf-8
s = input()
t = input()
ans = len(t)

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

print(ans)
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    S = input()
    T = input()
    len_s = len(S)
    len_t = len(T)
    ans = 1000
    for i in range(len_s-len_t+1):
        cunt = 0
        for j in range(len_t):
            if S[i+j] != T[j]:
                cunt += 1
        ans = min(ans, cunt)
    print(ans)

if __name__=='__main__':
    main()