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

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

ls = len(S)
lt = len(T)
ans = lt

for i in range(ls-lt):
    s = S[i:i+lt]
    cnt = 0
    for j in range(lt):
        if s[j] != T[j]:
            cnt += 1
    ans = min(ans, cnt)
    
print(ans)
import sys
input = sys.stdin.readline
S = input()
T = input()
score_list = []
for i in range(0, len(S)-len(T)):
  s = S[i:i+len(T)]
  score = sum([1 if s[i]==T[i] else 0 for i in range(len(s))])
  score_list.append(score)
if len(score_list) > 0:
  print(len(T) - max(score_list))
else:
  print(0)
S=input().strip()
T=input().strip()
ls = len(S)
lt = len(T)

x = lt
for i in range(0,ls-lt):
    m = 0
    for j in range(lt):
        if T[j] != S[i+j]:
            m += 1
    x = min(x,m)

print(x)
S = input()
T = input()
c =0
C = [0]
for i in range(len(S)):
  for j in range(len(T)):
    if S[i] == T[j] and i-j >= 0 and len(S)-i -1 >= len(T)-j -1:
      
      c = 1
      for k in range(len(T) - j-2):
        if S[i + k + 1] == T[j + k +1]:
          c += 1
      C.append(c)
      c = 0
      break
C.append(c)


print(len(T)-max(C))
S=input()
T=input()
def func():
    for i in reversed(range(1,len(T)+1)):
        p=T[0:i]
#        print(i,p)
        if (-1!=S.find(p)):
            return(len(T)-i)
        p=T[len(T)-i:len(T)]
#        print(i,p)
        if (-1!=S.find(p)):
            return(len(T)-i)

print(func())
strS = input()
strT = input()

maxRange = 0
l = 0
while l <= (len(strS)-len(strT)):
    m = 0
    count = 0
    while m < (len(strT)):
        if strS[l+m] != strT[m]:
            count += 1
        m += 1
    if maxRange > count:
        maxRange = count
    l += 1

print(maxRange)
s = input()
t = input()
if t in s:
  print(0)
else:
  for i in range(len(t)-1):
    i += 1
    t1 = t[:i]
    t2 = t[i:]
    if t2 in s:
      print(i)
      break
    i *= -1
    t3 = t[i:]
    t4 = t[:i]
    if t4 in s:
      print(i*-1)
      break
  print(len(t))
# coding: utf-8
from functools import reduce
from queue import Queue
from collections import deque

s = input()
t = input()

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

print(saisho_kyori)
S=str(input())
T=str(input())
ls=len(S)
lt=len(T)
m=0
for i in range(ls):
  A=S[i:lt]
  a=0
  for s,t in zip(A,T):
    if s==t:
      a+=1
  m=max(m,a)
print(lt-m)
def main():
    s = input()
    t = input()
    ans = 1010
    
    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(cnt)
    return
    

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

def getCommonCharNum(x, y):
    commonCharNum = 0
    for i in range(len(x)):
        if x[i] == y[i]:
            commonCharNum += 1
    return commonCharNum

for i in range(len(s) - len(t) + 1):
    maxCommonNum = 0
    tmpCommonCharNum = getCommonCharNum(s[i: len(t) + i], t)  #s[0, len(s)] → s[0 + last_i, len(s) + last_i]
    if maxCommonNum < tmpCommonCharNum:
        maxCommonNum = tmpCommonCharNum
print(len(t) - maxCommonNum)
import difflib

s = input()
t = input()

min = 10000

if t in s:
    print(min)
    exit()

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


    
print(min)
s = input()
t = input()
pos = True
for i in range(len(t)):
    if t[:len(t) - i] in s:
        print(i)
        pos = False
        break
if pos: print(len(t) - 1)
# -*- coding: utf-8 -*-
import sys

if __name__ == '__main__':
    S = input()
    T = input()
    
    for i in range(len(T), 0, -1): #Tのsubstringの文字数
        for j in range(0, len(T)-i+1): #Tのsubstringの開始位置
            if S[j:len(S)-1-(len(T)-i)+j+1].find(T[j:i-1+j+1]) != -1:
                print (len(T)-i)
                sys.exit()
s=input()
t=input()

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

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

minc = 1000

for i in range(sl):
    if i+tl-1 >= sl:
        break
    else:
        str1 = S[i:i+tl]
        count=0
        for j in range(tl):
            if str1[j] != T[j]:
                count+=1
        if count < minc:
            minc = count

print(count)
s = input()
t = input()
import copy
T = copy.deepcopy(t)
nagasa_t=len(t)
count1=0
count2=0
for i in range(nagasa_t):
  if t in s:
    break
  else:
    t= t[:-1]
    count1+=1
    if i == nagasa_t-1:
        count1=nagasa_t
for i in range(nagasa_t):
  if T in s:
    break
  else:
    T = T[1:]
    count2+=1
    if i == nagasa_t-1:
        count2=nagasa_t

print(min(count1,count2))
S = input()
T = input()

ans = int(10**10)
# 10**3文字以下なので、O(N**2)でも間に合う
for i in range(len(S) - len(T)):
    part = S[i:i+len(T)]
    cnt = 0
    for j, c in enumerate(part):
        if T[j] != c:
            cnt += 1
    ans = min(ans, cnt)
print(ans)
S = input()
T = input()

text = ''

for moji in T:
    text += moji
    if S.count(text) == 0:
        text = text[0:-1]
        break

if text == '':
    print(len(T)-1)
else:
    print(len(T)-len(text))
s = input()
t = input()
ans = 0
for i in range(len(t)):
    if s.count(t[i:]) != 0:
        ans = (len(t[i:]))
        break
if s.count(t[1:]) != 0:
    ans = max((len(t[1:])),ans)
print(len(t)-ans)
S = input()
T = input()

maxtmp = 0
for i in range(len(S)- len(T)):
    tmp = 0
    for j in range(len(T)):
        if S[i+j] == T[j]:
            tmp += 1
    if maxtmp < tmp:
        maxtmp = tmp
print(len(T) - maxtmp)
S = input()
T = input()

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

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

min_count = 10000000

for k in range(len(T)):
  count = k
  for i in range(len(S)-len(T)+1):
    if S[i+k] == T[k]:
      for j in range(1,len(T)-k):
        if S[i+j] != T[k+j]:
          count += 1
      if count < min_count:
        min_count = count
        
print(min_count)
s = input()
t = input()
import copy
T = copy.deepcopy(t)
nagasa_t=len(t)
count1=1
count2=1
for i in range(nagasa_t):
  if t in s:
    break
  else:
    t= t[:-1]
    count1+=1
    if i == nagasa_t-1:
        count1=nagasa_t
for i in range(nagasa_t):
  if T in s:
    break
  else:
    T = T[1:]
    count2+=1
    if i == nagasa_t-1:
        count1=nagasa_t

print(min(count1,count2))
s = input()
t = input()
if t in s:
  print(0)
else:
  for i in range(len(t)-1):
    i += 1
    t1 = t[:i]
    t2 = t[i:]
    if t2 in s:
      print(i)
      break
    i *= -1
    t3 = t[i:]
    t4 = t[:i]
    if t4 in s:
      print(i*-1)
      break
def main():
    S = input()
    T = input()

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

    if len(S) == len(T) and S != T:
        min_change = len(T)

    print(min_change)


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

for i in range(len(s)-len(t)+1):
    n=0
    for j in range(len(t)-1):
        if s[i] == t[j]:
            n+=1
    list.append(n)
print(len(t)-max(list))
from collections import deque
import sys, copy, itertools,heapq
input = sys.stdin.readline

S = input().rstrip()
T = input()
s=len(S)
t= len(T)
ANS=[0]*(len(S))

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

#print(ANS)
print(t-max(ANS))
S = input()
T = input()
ans = 1001
for i in range(len(S)-len(T)):
    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(0,len(s)-len(t)):
  cnt = 0
  for (m,n) in zip(s[i:i+len(t)],t):
    if m!=n : cnt += 1
  ans = min(ans,cnt)
  
print(ans)
import random, string
S = input()
T = input()
l = len(T)
L = len(S)
max_ans = -1
for i in range(L):
   for j in range(l):
      ans = 0
      if i + l > L:
         continue
      if T[j] == S[i + j]:
            ans += 1
   max_ans = max(max_ans, ans)
print(l - max_ans)
s = input()
t = input()

len_t = len(t)

ans = 999999999999
for i in range(len(s)-len(t)):
    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()

if t in s:
    print("0")

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 main():
    s = input()
    t = input()
    ans = 100000000
    
    for i in range(0,len(s)-len(t)+1):
        cnt = 0
        for sub_s, sub_t in zip(s[i:len(t)+i],t):
            if sub_s != sub_t:
                cnt += 1
        if cnt < ans:
            ans = cnt
    print(cnt)
    

if __name__ == "__main__":
    main()
S=input()
T=input()
n=len(T)
l=len(S)-n
p=0
for i in range(l):
    j=0
    m=S[i:i+n]
    
    for k in range(n):
        if(m[k]==T[k]):
            j+=1

    if(p<j):
        p=j
print(n-p)
s = input()
t = input()
N = len(t)
count = 0
for i in range(N):
  if t[i] != s[i]:
    count += 1

print(count)
import random, string
S = input()
T = input()
l = len(T)
L = len(S)
max_ans = -1
for i in range(L):
   if i + l > L:
      continue
   for j in range(l):
      ans = 0
      if T[j] == S[i + j]:
            ans += 1
   max_ans = max(max_ans, ans)
print(l - max_ans)
S = list(input())
T = list(input())
ans = len(T)

for i in range(len(S)-len(T)):
    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()
sl = len(S)
tl = len(T)

for i in range(tl + 1):
    if T[:tl - i] in S[:sl - i]:
        print(i)
        exit()
    elif T[i:tl] in S[i:sl] :
        print(i)
        exit()
# -*- coding: utf-8 -*-
S = str(input())
T = str(input())

len_S = len(S)
S_part_dict = {}
for i in range(len_S):
    for j in range(i, len_S):
        S_part_dict[S[i:j + 1]] = i

max_part_len = 0
for part_str, len_from_top in S_part_dict.items():
    now_len_part = len(part_str)
    if now_len_part <= max_part_len:
        continue
    if T[len_from_top:].count(part_str):
        max_part = now_len_part

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

count = 0
max = 0

for i in range(s-t):
  for j in range(t):
    if S[i+j] == T[j]:
      count += 1
  if count > max:
    max = count
    count = 0
  else:
    count = 0

print(t-max)
s = input()
t = input()
ans = len(s)+1
for i in range(len(s)-len(t)):
  cnt = 0
  for j in range(len(t)):
    if s[i+j]!=t[j]:
      cnt += 1
  ans = min(ans, cnt)
print(ans)
#from sys import stdin

#input = stdin.readline
#inputRstrip = stdin.readline().rstrip

#x = input().rstrip()
#n = int(input())

#a,b,c = input().split()
#a,b,c = map(int, input().split())

ST = [input() for i in range(2)]
S = ST[0]
T = ST[1]
ans = len(T)

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

ans = len(t)
for i in range(len(s) - len(t)):
    tmp_ans = 0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            tmp_ans += 1
    ans = min(ans, tmp_ans)
print(ans)
s=input()
t=input()
ans=10000
for i in range(len(s)-len(t)):
    tmp=0
    for j in range(len(t)):
        if(s[i+j]==t[j]):
            tmp+=1
    ans=min(ans,len(t)-tmp)
print(ans)
import numpy as np
s = np.array(list(input()))
t = np.array(list(input()))
s_sub = np.array(list((s[i:i+len(t)] for i in range(len(s)-len(t)+1))))
print(s_sub)
ans = [0]*len(s_sub)
for i in range(len(s_sub)):
    ans[i] = np.count_nonzero(s_sub[i] == t)
print(len(t)-max(ans))
s=str(input())
t=str(input())

flag=False

m=0

for i in range(len(s)-len(t)):
  cnt=0
  for j in range(len(t)):
    #print(s[i+j],t[j])
    if s[i+j]==t[j]:
      cnt+=1
      flag=True
    else:
      if flag==True:
        if m==0 or m<cnt:
          m=cnt
        cnt=0
        flag=False

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

ans = len(T)

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

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

min_score = len(t)
for i in range(len(s) - len(t)):
  s_p = s[i:i+len(t)]
  count_wrong = 0
  for j in range(len(t)):
    if t[j] != s_p[j]:
      count_wrong += 1
  min_score = min(count_wrong, min_score)
  
print(min_score)
import numpy as np
from copy import deepcopy
from heapq import heappop, heappush
from bisect import bisect_left, bisect
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations

S = input()
T = input()

replaced = S.replace(T, '')
print(len(S) - len(replaced))

exit()
s = list(input())
t = list(input())
m = len(s)
l = len(t)
ans = m
for i in range(m-l):
  defe = 0
  for j in range(l):
    if t[j] != s[i+j]:
      defe += 1
  ans = min(defe, ans)
  
print(ans)
def Qb():
    s = input()
    t = input()

    ans = len(t)
    for v in range(len(t)):
        for x in range(len(t) - v):
            z = t[v:len(t) - x]
            if z in s[v:len(s) - x]:
                if v + x < ans:
                    ans = v + x
    print(ans)


if __name__ == '__main__':
    Qb()
s=input()
t=input()
ans=1000
num=0
for i in range(len(s)-len(t)):
    num=0
    for j in range(len(t)):
        if s[i+j]!=t[j]:
            num+=1
    ans=min(num,ans)
print(ans)
S = input()
T = input()
C = []
if len(S) == len(T):
  c = 0
  for j in range(len(T)):
      if S[j] == T[j]:
        c += 1
  C.append(c)
else:
  for i in range(len(S) - len(T)+1):
    s = S[i:len(T)+i]
    c = 0
    for j in range(len(T)):
      if s[j] == T[j]:
        c += 1
  C.append(c) 
print(len(T)-max(C))
s = input()
t = input() 
ans = 0
for i in range(len(t)+1):
  for j in range(len(t)+1):
    if i < j:
      t2 = t[i:j]
      #print(t2)
      if (t2 in s) and ans < j-i and i<=s.find(t2):
        ans = j-i
        #print(ans)
        #print(s.find(t2))
print(len(t)-ans)
S = input()
T = input()
n = len(S)

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


ans = len(t)
flag = False
for i in range(len(t)+1, 0, -1):
    for j in range(0, len(t)-i+1):
        sb = t[j:j+i]
        if sb in s[j:]:
            ans = len(t)-len(sb)


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

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

ans = 1000
for i in range(len_s - len_t + 1):
    cnt = 0
    l = [0]
    for j in range(len_t):
      if s[i : i + len_t][j] == t[j]:
          cnt += 1
      else:
          l.append(cnt)
          cnt = 0
      max_cnt = max(l)

    ans = min(ans, len_t - max_cnt)

print(ans)
s=input()
t=input()
ma=0
for i in range(len(t)):
    for j in range(i,len(t)):
        if t[i:j+1] in s[i:]:
            
            ma=max(ma,j-i+1)
        else:
            break
print(len(t)-ma)
s = input()
t = input()
if t in s: print(0)
else:
    for i in range(1, len(t) + 1):
        if t[:i] in s:
            print(i)
            break
    for j in t:
        if j in s:
            print(len(t) - 1)
            break
S = input()
T = input()
A = len(T)
for i in range(len(T)):
    M = S.find(T[i:])
    if M >= i and A > i:
        A = i
    M = S.rfind(T[i:])
    if M >= i and A > i:
        A = i
for i in range(1,len(T)):
    M = S.find(T[:i])
    if M >= i and A > i:
        A = i    
    M = S.rfind(T[:i])
    if M >= i and A > i:
        A = i
print(A)
import re

S, T = [str(input()) for _ in range(2)]

index_list = []

match_count = 0

if T in S:
  print(0)
else:
  index = 0
  counter = 0
  for s in S:
    for m in re.finditer(str(s), str(T)):
      if index >= m.start():
        if m.start() - 1 in index_list:
          print(s, m.start())
          counter += 1
        else:
          print(s, m.start())
          counter = 1
        index_list = []
        index_list.append(m.start())
    index += 1
  
  print(len(T)-counter)
# 171 B
S = input()
T = input()
ans = []
for i in range(0, (len(S)-len(T) + 1)):
    tmp = 0
    #print(i)
    for j in range(0, len(T)):
        if T[j] != S[i +j]:
            tmp += 1
            print(S[i +j] + T[j])
        #print('tmp:' + str(tmp))
    ans.append(tmp)
        
print(min(ans))
s = input()
t = input()

ns = len(s)
nt = len(t)

ans = nt

for i in range(ns - nt):
  d = 0
  for j in range(nt):
    if t[j] != s[i+j]:
      d += 1
  ans = min(ans, d)
print(ans)
s = input()
t = input()

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

ans = len_t

for i in range(len_s - len_t):
  u = s[i: i+len_t]
  d = sum(0 if c1 == c2 else 1 for c1, c2 in zip(t, u))
  ans = min(d, ans)

print(ans)
S = input().rstrip()
T = input().rstrip()
mn = len(T)
for i in range(len(S) - len(T)):
	n = 0
	for j in range(len(T)):
		if S[i + j] != T[j]:
			n += 1

	if n < mn:
		mn = n

print(mn)
s = input()
t = input()

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

ans = 1000
for i in range(n - nt):
    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, T = input(), input()
nT = len(T)
f = lambda a, b: sum(1 for x, y in zip(a, b) if x != y)
m = nT
for i in range(len(S) - nT):
    m = min(m, f(S[i:i+nT], T))
    if m == 0:
        break

print(m)
#!/usr/bin/python3
# -*- coding: utf-8 -*-
s = input()
t = input()
min_count = 1000
for i in range(len(s) - len(t)):
    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 = str(input())
T = str(input())

ans = len(T)

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

change = 0

for i in range(0, len(sub_string)):
  if sub_string[i] in string:
    if sub_string[i] != string[i]:
      change += 1
  else: 
    change += 1
    
if change == len(sub_string):
  change = 1
  
print(change)
xmoji=input()
ymoji=input()

x=len(xmoji)
y=len(ymoji)
tempmin = 0
for i in range(0,x-y):
    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)
def main():
    s = str(input())
    t = list(str(input()))
    num = len(t) - 1
    for i in range(1, len(t)+1):
        moji = "".join(t[0:i])
        if moji in s:
            if num > len(t)-i:
                num = len(t)-i
        
    print(num)
main()
def count(A,B):
    counter=0
    for i in range(len(A)):
        if A[i]==B[i]:
            counter+=1
    return len(A)-counter

S = input()
T = input()
t = len(T)
s = len(S)
_min = float('inf')
for i in range(s-t):
    _min = min(_min,count(S[i:i+t],T))
print(_min)
a=input()
b=input()
c=999

for i in range(len(a)-len(b)+1):
  d=0
  for j in range(len(b)):
    if a[i+j]!=b[j]:
      d+=1
  if d<c:
    c=d
print(c)
S=input()
T=input()
check=[]
for i,ss in enumerate(S[:-len(T)+1]):
    check.append(0)
    for j,tt in enumerate(T):
        if tt==S[i+j]:
            check[i]+=1
# print(check)
check.append(0)
print(len(T)-max(check))
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 = 1000000
for i in range(len(s)-len(t)):
    cnt=0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            cnt += 1
    ans = min(ans,cnt)
print(ans)
def resolve():
    S = input()
    T =input()
    s_n  = len(S)
    t_n = len(T)

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

    print(ans)

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

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

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

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


def a():
    l = len(T)
    for i in range(l, 0, -1):
        for j in range(0, l-i+1):
            if T[j:j+i] in S[j:i+j]:
                return l-i


print(a())
S = input()
T = input()
ans = 0
count = 0 
saishou = 0

for i in range(len(T)):
  for j in range(i, len(S)-len(T)+i):
    c = 0
    while T[i+c] == S[j+c]:
      c = c + 1
      ans = max(ans, c)
      if i + c > len(T)-1 or j + c  > len(S)-1 :
        break

saishou = len(T) - ans
print(saishou)
S = input()
T = input()

cand = []
for start in range(len(S) - len(T) + 1):
    print(S[start:start+len(T)])
    cnt = sum([not T[i] == S[start:start+len(T)][i] for i in range(len(T))])
    cand.append(cnt)

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

cnt = 0

for i in range(1, len(t) + 1):
    for j in range(len(t) - i + 1):
        if t[j:j+i] in s:
            cnt = max(cnt, i)

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

len_s, len_t = len(S), len(T)
ans = 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
    if tmp < len_t:
        ans = tmp
print(ans)
s = input()
t = input()
t_len = len(t)
ans = 0
for i in range(t_len):
  word = t[0:t_len-i]
  for j in range(len(s)-len(word)):
    if s[j:j+t_len-i]==word:
      print(i)
      exit(0)
else:
  print(t_len-1)
if __name__ == '__main__':
    a, b = input(), input()
    min = 1e10
    for i in range(len(a) - len(b)):
        c = 0
        for j in range(len(b)):
            if a[i + j] != b[j]:
                c += 1
        if c < min:
            min = c
    print(min)
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 ans>ANS:
            ANS=ans
        if a[j]==t[j]:
            ans+=1
print(len(t)-ANS)
S = input()
T = input()

for i in range(len(T)+1):
    lT = len(T)-i+1
    sT = 0
    while lT != len(T)+1:
        if T[sT:lT] in S[sT:len(S)]:
            print(i-1)
            exit()
        else:
            sT += 1
            lT += 1

print(len(T))
def main():
    S = input()
    T = input()
    l = len(T)
    m = l
    for i in range(len(S)-l):
        r = 0
        for j in range(l):
            if S[i+j] != T[j]:
                r += 1
        if r < m:
            m = r
    return m
print(main())
S = input()
T = input()

ans = len(T)
num = len(S)-len(T)
for i in range(num):
    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()
l = len(t)
ans = l
for i in range(l):
    for j in range(i+1,l+1):
        #print(i,j)
        #print(t[i:j])
        fin = -(l-j)
        if j==l:
            fin = len(s)
        #print(s[i:fin])
        #print("---")

        if s[i:fin].count(t[i:j])>0:
            ans = min(ans,l-len(t[i:j]))
print(ans)
s = input()
t = input()

n = len(s)
m = len(t)
ans = float("inf")
for i in range(n-m):
  p = 0
  for j in range(m):
    if s[i+j] != t[j]: p += 1
  if p < ans: ans = p
print(ans)