peterverebics/CodeNet_Python_118 huggingface dataset:
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
import random
J=10**19
###############################################################################\n=17
s=input()
t=input()
ans=10**6
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 = input()
t = input()
n, m = len(s), len(t)

ans = 0
for i in range(n - m + 1):
    match = 0
    for j in range(m):
        if s[i + j] == t[j]:
            match += 1
    ans = max(ans, match)

print(m - ans)
s = input()
t = input()
res = []
for i in range(len(s)-len(t)+1):
    x = s[i:i+len(t)]
    count = sum(1 for a, b in zip(t, x) if a != b)
    res.append(count)

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

num = len(s) - len(t) + 1

ans = []
for i in range(num):
  counter = 0
  for j in range(len(t)):
    if t[j] == s[j+i]:
      counter += 1
  ans.append(counter)
  
print(len(t) - max(ans))
s = list(input())
t = list(input())
ls = len(s)
lt = len(t)
ans = 1000
for i in range(ls-lt+1):
    count = 0
    for j in range(lt):
        if s[j+i] != t[j]:
            count += 1
    ans = min(ans,count)
print(ans)
S = input()
T = input()

ans = 0

for i in range(len(S)-len(T)+1):
  same = 0
  for j in range(len(T)):
    if S[i+j] == T[j]:
      same += 1
  else:
    ans = max(ans, same)
    
print(len(T) - ans)
'''
Contest 177 - Task B


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

if __name__ == "__main__":
    haystack = input()
    needle = input()

    dists = []
    for i in range(len(haystack) - len(needle) + 1):
        sub = haystack[i : i+len(needle)]
        dists.append(count_changed_chars(sub, needle))
    print(min(dists))
S = input()
T = input()

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

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

c = 0
u = []
for i in range(len(s)-len(t)+1):
    c = 0
    for j in range(len(t)):
        if t[j]!=s[j+i]:
            c+=1
    u.append(c)
print(min(u))
def main():
    s = input()
    t = input()

    # sがtの長さにおいて一致している最大の文字数を特定
    max_counter = 0

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

    answer = len(t) - max_counter
    print(answer)


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

t_len = len(t)
s_len = len(s)
max_ = 0
temp = 0

for i in range(s_len - t_len + 1):
  for j in range(t_len):
    if s[i + j] == t[j]:
      temp += 1
  if max_ < temp:
    max_ = temp
  temp = 0

print(t_len - max_)
s = input()
t = input()

ans = 10004
cnt = 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 = min(ans, cnt)
print(ans)
s = input()
t = input()
n_s = len(s)
n_t = len(t)
ans = float("inf")
for i in range(n_s-n_t+1):
    count = 0
    for j in range(n_t):
        if s[i+j] != t[j]:
            count += 1
    ans = min(ans, count)
print(ans)
S = input()
T = input()

ans = 1000
for start in range(len(S) - len(T) + 1):
  diff = 0
  for i in range(len(T)):
    if not T[i] == S[start + i]:
      diff += 1
  ans = min(ans, diff)
print(ans)
S = input()
T = input()
lt = len(T)
ans_min = len(T)
for i in range(len(S)-lt+1):
    s_tmp = S[i: i + lt]
    ans_tmp = 0
    for j in range(lt):
        if s_tmp[j] != T[j]:
            ans_tmp += 1
    ans_min = min(ans_min, ans_tmp)
print(ans_min)
S = input()
T = input()

max_num = 0
count = 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 max_num < count:
    max_num = count
    
#print(max_num)
print(len(T)-max_num)
S = input()
T = input()

if len(T) > len(S) or len(S) == 0:
    print(0)

answer = float("inf")
for i in range(len(S) - len(T) + 1):

    sub = S[i: i + len(T)]

    unique = 0
    for s,o in zip(sub, T):
        if s != o:
            unique += 1
    
    answer = min(answer, unique)

print(answer)
s = input()
t = input()
ls = len(s)
lt = len(t)
ans = float('inf')
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=list(input())
T=list(input())
ans_li=[]
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_li.append(ans)
print(min(ans_li))
s=input()
t=input()
slen=len(s)
tlen=len(t)
min=tlen
def howdifferent(t1,t):
    count=0
    for i in range(len(t)):
        if t1[i]!=t[i]:
            count+=1
    return count
for i in range(slen-tlen+1):
    t1 = s[i:]
    if howdifferent(t1,t)<min:
        min = howdifferent(t1,t)
print(min)
S = input()
T = input()
ans = len(T)

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

N, M = len(S), len(T)
ans = float("inf")
for i in range(N-M+1):
    tmp = 0
    for j in range(M):
        if S[i+j] != T[j]:
            tmp += 1
    ans = min(ans, tmp)
print(ans)
s = input()
t = input()

a = []

for i in range(len(s) - len(t) + 1):
    w = s[i:i + len(t)]
    sum = 0
    for j in range(len(t)):
        if w[j] != t[j]:
            sum += 1
    a.append(sum)

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

count = 0
reg = 0

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

reg = len(t) - reg
print(reg)
################ B
s = input()
t = input()

co = 0
num = 0
N = 0
N_max = 0
for i in range(len(s)-len(t)+1):
    for k in range(len(t)):
        if s[i+k] == t[k]:
            N += 1
    N_max = max(N,N_max)
    N = 0
print(len(t)-N_max)
S = input()
T = input()
ans = len(T)
for i in range(len(S)-len(T)+1):
    count = 0
    for j in range(len(T)):
        if S[i:i+len(T)][j:j+1] != T[j:j+1]:
            count += 1
    ans = min(count,ans)
    
print(ans)
def process():
    s = input()
    t = input()
    ls, lt = len(s), len(t)
    minchanges = float("inf")

    for i in range(ls-lt+1):
        changes = 0
        for j in range(lt):
            changes += 0 if s[i+j] == t[j] else 1
            if changes > minchanges:
                break
        if changes == 0:
            return 0
        #print(i, changes)
        minchanges = min(minchanges, changes)
    return minchanges


print(process())
s = input()
t = input()

ans = 100000

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

for i in range(n - m + 1):
    temp = s[i:i + m]
    count = 0
    for a, b in zip(temp, t):
        if a != b:
            count += 1
    ans = min(count, ans)

print(ans)
s=input()
t=input()
ans=10**10
for i in range(len(s)-len(t)+1):
    ss=s[i:i+len(t)]
    m=0
    for j in range(len(t)):
        if ss[j]!=t[j]:
            m+=1
    ans=min(ans,m)
print(ans)
S = input()
T = input()
itch = 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
    itch = max(tmp, itch)
    tmp = 0
print(len(T)-itch)
s = input()
t = input()

min = len(t)
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(a >= min):
        break
  if(a < min):
    min = a
print(min)
def diff(a, b):
    ret = 0
    for c1, c2 in zip(a, b):
        if c1 != c2:
            ret += 1

    return ret

S = input()
T = input()

l = len(T)
ans = 10 ** 9
for i in range(len(S) - l + 1):
    # print(S[i:i+l])
    ans = min(ans, diff(S[i:i+l], T))

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

ans = 1000000  # 適当に1001以上を初期値にしておきます

# Tが1文字のときlen(S)回、2文字のときlen(S) - 1回 …… なので、
# len(S) - len(T) + 1 回です
for i in range(len(S) - len(T) + 1):
    score = 0
    U = S[i:i + len(T)]  # Sのi文字目から連続するlen(T)文字を、Uとします
    for j in range(len(T)):
        if U[j] != T[j]:
            score += 1
    ans = min(ans, score)

print(ans)
def solve(l_1,l_2):
    result = 0
    for i,j in zip(l_1,l_2):
        if i != j:
            result += 1
    return result

s = input()
t = input()
n_s = len(s)
n_t = len(t)
ans = 10**5

for i in range(0,n_s-n_t+1):
    l = s[i:i+n_t]
    ans = min(ans,solve(t,l))

print(ans)
S = input()
T = input()
L = len(T)
res = 10000
for i in range(len(S)-L+1):
    tmp = 0
    for a, b in zip(list(S[i:i+L]), list(T)):
        tmp += 1 if a != b else 0
    res = min(tmp, res)
print(res)
s = list(str(input()))
t = list(str(input()))
col = []
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
	col.append(count)
print(len(t)-max(col))
s = input()
t = input()
minr = len(t)
s_t_d = len(s) - len(t)
for i in range(s_t_d + 1):
    cnt = 0
    for ss, ts in zip(s[i:i + len(t)], t):
        if ss != ts:
            cnt += 1
    minr = min(minr, cnt)
print(minr)
s = input()
t = input()
n = len(s) - len(t) + 1
ans = len(t)
for i in range(n):
    temp = 0
    for j in range(len(t)):
        if t[j] != s[j+i]:
            temp += 1
    ans = min(temp,ans)
print(ans)
s=input()
t=input()
c=len(t)
for i in range(len(s)-len(t)+1):
  d=0
  for j in range(len(t)):
    if s[i+j]!=t[j]:
      d+=1
  if d<c:
    c=d
print(c)
import sys
s = sys.stdin.readline().rstrip("\n")
t = sys.stdin.readline().rstrip("\n")
l = len(s)-len(t)+1
ans = 10000000000
for i in range(l):
    s_ = s[i:i+len(t)]
    ans_ = 0
    for j in range(len(t)):
        if t[j] != s_[j]:
            ans_ += 1
    ans = min(ans,ans_)
print(ans)
S=input()
T=input()

Z=0
K=[]
for i in range(len(S)-len(T)+1):
    for j in range(len(T)):
        if S[j+i]!=T[j]:
            Z+=1
    K.append(Z)
    Z=0
print(min(K))
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(ans, count)
    
print(ans)
S = input()
T = input()

l = len(T)

if l == len(S):
    cnt = 0
    for i in range(l):
        if S[i] != T[i]:
            cnt += 1
    print(cnt)
    exit()

ans = []
for i in range(len(S)-l):
    cnt = 0
    for n in range(l):
        if S[i+n] != T[n]:
            cnt += 1
    ans.append(cnt)
    
print(min(ans))
s = input()
t = input()
ans = len(t)
for i in range(len(s)-len(t)+1):
    cur = 0
    for j in range(len(t)):
        cur += (s[i+j] != t[j])
    ans = min(ans, cur)
print (ans)
def main():
	S = input()
	T = input()
	ls = len(S)
	lt = len(T)
	ans = []
	for i in range(ls - lt + 1):
		cnt = 0
		for j in range(lt):
			if S[i + j] != T[j]:
				cnt += 1
		ans.append(cnt)
	print(min(ans))

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

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

kotae = 1000
for i in range(lens-lent+1):
    temp = 0
    for j in range(lent):
        if(s[i+j] == t[j]):
            temp += 1
    kotae = min(kotae,lent-temp)

print(kotae)
S = input()
T = input()

ans=len(T)

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

print(len(T)-itti)
s = input()
t = input()
s_len = len(s)
t_len = len(t)

ans = 99999

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

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

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

print(Min)
s = input()
t = input()
mini =10000000

for i in range(len(s)-len(t)+1):
    count = 0
    for z in range(len(t)):
        if s[i+z] != t[z]:
            count += 1
            
    if count < mini :
            mini = count

print(mini)
s = input()
t = input()


ans = 1000

for i in range(len(s)-len(t)+1):
    #print(s[i:i+len(t)])
    cnt = 0
    for j in range(len(t)):
        
        if t[j] != s[i:i+len(t)][j]:
            cnt +=1
        #print(cnt,t[j],s[i:i+len(t)][j])
    #print(cnt)
    ans = min(ans,cnt)
print(ans)
s = input()
t = input()
ans = []
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.append(cnt)
    
cnt2 = min(ans)
print(cnt2)
def main():
    s = input()
    t = input()
    ld = len(s)-len(t)
    ans = 9999999999
    for i in range(ld+1):
        v = sum([0 if a==b else 1 for (a,b) in zip(list(s[i:]),list(t))])
        ans = min(ans, v)
    print(ans)

main()
S=input()
T=input()
ans=10**5
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(ans,len(T)-a)
print(ans)
s = input('')
t = input('')

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

d=0
for j in range(len_t):
    if s[j]!=t[j]:
        d+=1
for i in range(len_s - len_t):
    s2 = s[i:i+len_t]
#    print(s2)
    d2=0
    for j in range(len_t):
        if s2[j]!=t[j]:
            d2+=1
#   print("{}/{}".format(s2,t))
    if d2<d:
        d=d2
print(d)
s = input()
t = input()
ans = 100000
for i in range(len(s) - len(t) + 1):
    lt = len(t)
    cnt = 0
    for a, b in zip(s[i:i+lt], t):
        if a != b:
            cnt += 1
    ans = min(ans, cnt)
print(ans)
s = input()
t = input()
ls = len(s)
lt = len(t)
min_count = 1000
for i in range(ls-lt+1):
  count = 0
  for j in range(lt):
    if s[i:i+lt][j] != t[j]:
      count += 1
  if min_count > count:
    min_count = count
print(min_count)
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)
import sys
S = input()
T = input()
if T in S:
  print(0)
  sys.exit(0)

maxSameCharCount = 0
for i in range(len(S)-len(T)+1):
  sameCharCount = 0
  for j in range(len(T)):
    if S[i+j]==T[j]:
      sameCharCount += 1
  if maxSameCharCount < sameCharCount:
    maxSameCharCount = sameCharCount
print(len(T)-maxSameCharCount)
s=input()
t=input()

max_itti=0

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

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

ans=0

for i in range(0, ls-lt+1):
    cnt = 0 
  
    for j in range(lt):
        if s[i+j] == t[j]:
            cnt+=1 
    ans = max(ans, cnt)
    
print(lt-ans)
S = input()
T = input()

count = 0
max_count = 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 max_count <= count:
                max_count = count
        if j == (len(T) -1):
            count = 0

print(len(T) - max_count)
S = input()
T = input()

import math
res = math.inf

from collections import Counter

mt = list(map(ord, list(T)))
for i in range(len(S) - len(T) + 1):
    # print(S[i: i + len(T)], [a - b for a, b in zip(map(ord, list(S[i: i + len(T)])), mt)])
    res = min(res, len(T) - Counter([a - b for a, b in zip(map(ord, list(S[i: i + len(T)])), mt)])[0])
print(res)
s=list(input())
t=list(input())
xs=len(s)
xt=len(t)
count=1000
for i in range(xs-xt+1):
    temp=0
    for j in range(xt):
        if s[i+j]!=t[j]:
            temp+=1
    count=min(temp,count)
print(count)
import sys
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda: list(map(int, input().strip().split()))


def f(s, t):
	# print(s, t)
	ans = 0
	for i in range(len(t)):
		ans += (s[i] != t[i])
	return(ans)

def main():
	s = input().strip(); t = input().strip()
	ans = f(s, t)

	for i in range(1, len(s)-len(t)):
		ans = min(ans, f(s[i:i+len(t)], t))
	print(ans)


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


num_same_all = 0
for i in range(len(S)-len(T)+1):
    num_same = 0
    for j in range(len(T)):
        if S[j+i] == T[j]:
            num_same += 1
    
    if num_same_all < num_same:
        num_same_all = num_same

print(len(T)-num_same_all)
S = input()
T = input()

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

print(len(T)-tmp)
S = input()
T = input()
ans = float('inf')
d = len(S) - len(T) + 1

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

print(ans)
s=list(input())
t=list(input())
ans=10**7
for i in range(len(s)-len(t)+1):
  c=0
  for j in range(len(t)):
    if s[i+j]!=t[j]:
      c=c+1
  if c<ans:
    ans=c
print(ans)
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
    
    if count<ans:
        ans = count

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

ans = 9999999999999999999
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().rstrip()
T = input().rstrip()

ans = 1000
for offset in range(len(S) - len(T) + 1):
    miss = 0
    for s, t in zip(S[offset:offset+len(T)], T):
        if s != t:
            miss += 1
    ans = min(ans, miss)

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


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

ans = 1000

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
      
  ans = min(ans, count)
  
print(ans)
s=input()
t=input()
ANS=0
ans=0
for i in range(len(s)-len(t)+1):
    a=s[i:i+len(t)]
    ans=0
    for j in range(len(a)):
        if a[j]==t[j]:
            ans+=1
        if ans>ANS:
            ANS=ans
print(len(t)-ANS)
S = input()
T = input()

res = len(T)
for i in range(len(S)-len(T)+1):
  target = S[i:i+len(T)]

  matchCount = 0
  for s, t in zip(T, target):
    if s == t:
      matchCount += 1
  res = min(res, len(T)-matchCount)

print(res)
def count_diff(a,b):
    cnt = 0
    for c1,c2 in zip(a, b):
        if c1 != c2:
            cnt += 1
    return cnt

S = str(input())
T = str(input())
mn = 100000

for i in range(len(S)-len(T)+1):
    s = S[i:i+len(T)]
    x = count_diff(s,T)
    mn = min(mn,x)

print(mn)
S = input()
T = input()
minA = float("inf")
for i in range(len(S) - len(T) + 1):
    sumA = 0
    for j in range(len(T)):
        if S[i + j] != T[j]:
            sumA += 1
    minA = min(minA, sumA)
print(minA)
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()

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

print(ans)
S = input().rstrip()
T = input().rstrip()
res = float("inf")
for i in range(len(S)-len(T)+1):
    t = 0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            t += 1
    res = min(t,res)
print(res)
S = input()
T = input()
res = 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 = cnt + 1
    res = min(res, cnt)
print(res)
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

s = ins()
t = ins()
ls = len(s)
lt = len(t)
mn = BIG
for i in range(ls-lt+1):
    x = 0
    for j in range(lt):
        if s[i+j]!=t[j]:
            x += 1
    mn = min(mn,x)
print(mn)
S = list(input())
T = list(input())

change_num_array = []
for j in range(0, len(S)-len(T)+1):
    change_num = 0
    for i in range(len(T)):
        if S[j+i] != T[i]:
            change_num += 1
    change_num_array.append(change_num)
print(min(change_num_array))
s = input()
t = input()

s_len =len(s)
t_len =len(t)
count = 0
ans = []



for i in range(s_len - t_len + 1):
    for j in range(t_len):
        if s[i:t_len + i][j] != t[j]:
            count += 1
    ans.append(count)
    count = 0

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


U=[0]*(len(S)-len(T)+1)
c=[0]*(len(S)-len(T)+1)
for j in range(len(S)-len(T)+1):
    U[j]=S[j:j+len(T)]
    for i in range(len(T)):
        if U[j][i]==T[i] :c[j]=c[j]+1

print(len(T)-max(c))
s = input()
t = input()

lens = len(s)
lent = len(t)
cnt_min = 10**5
for i in range(lens-lent+1):
  tmp = 0
  for j in range(lent):
    if s[i+j] != t[j]:
      tmp += 1
  if tmp < cnt_min:
    cnt_min = tmp
    
print(cnt_min)
# = map(int, input().split())
# = int(input())
S = input()
T = input()
N = len(S)
M= len(T)
ans = N


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

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
    ans = min(tmp, ans)
print(ans)
s = input()
t = input()
ans = 10000000
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)
S = input()
T = input()

best = len(S) + 100
for i in range(len(S)):
    if i + len(T) > len(S):
        break
    pair = S[i : i + len(T)]
    diffs = 0
    for a, b in zip(pair, T):
        if a != b:
            diffs += 1
    best = min(best, diffs)
print(best)
s = input()
t = input()

LS = len(s)
LT = len(t)
# 最長で何文字一致するか
max_match = 0
for i in range(LS - LT + 1):
    ss = s[i:i+LT]
    match = 0
    for a,b in zip(t, ss):
        if a==b:
            match += 1
            max_match = max(max_match, match)

print(LT - max_match)
inpl = lambda: list(map(int,input().split()))
S = input()
T = input()
M = len(S)
N = len(T)

ans = N
for i in range(M-N+1):
    tmp = 0
    for j in range(N):
        if S[i+j] != T[j]:
            tmp += 1
            if tmp >= ans:
                break
    else:
        if tmp < ans:
            ans = tmp
print(ans)
S = str(input())
T = str(input())
s = len(S)
t = len(T)
ans = []
for i in range(s-t+1):
    count = 0
    U = S[i:i+t]
    for j in range(t):
        if U[j] != T[j]:
            count += 1
    ans.append(count)

print (min(ans))
import sys
input = lambda: sys.stdin.readline().rstrip('\r\n')

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

s = input()
t = input()
n = len(t)
ans = 10 ** 10
for i in range(len(s) - n + 1):
    ans = min(ans, check(s[i: i + n], t))
print(ans)
S=input()
T=input()

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

def f(s1,s2):
  r=0
  for i,j in zip(s1,s2):
    if i != j: r += 1
  return r

a=len(S)
for i in range(len(S)-len(T)+1):
  r = f(S[i:i+len(T)],T)
  if a > r: a = r

print(a)
S = input()
T = input()

ans = 10000
for i in range(len(S)-len(T)+1):
    count = 0
    for elts, eltt in zip(S[i:i+len(T)], T):
        if elts != eltt:
            count += 1
    ans = min(ans, count)

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

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