peterverebics/CodeNet_Python_118 huggingface dataset:
def main():
    S = input()
    T = input()
    if T in S:
        print(0)
    else:
        for i in range(len(T)-1, 0, -1):
            for j in range(len(T)-i+1):
                if T[j:j+i] in S[j:]:
                    print(len(T) - i)
                    exit()
        else:
            print(len(T))

if __name__ == '__main__':
    main()
S=input()
T=input()
ANS=[]
for start in range(len(S)):
  ans = 0
  for j in range(len(T)):
    if S[start] != T[j]:
      ans += 1
  ANS.append(ans)
print(min(ANS))
s = input()
t = input()
maxi = 0 
for i in range(len(t)):
    maxG = 0
    for l, j in zip(s[i:len(t)], t):
        if l == j:
            maxG += 1
    maxi = max(maxi, maxG)
print(len(t)-maxi)
import sys
input = sys.stdin.readline
S = input()
T = input()
score_list = []
for i in range(len(S) - len(T) + 1):
  s = S[i:i+len(T)]
  score = 0
  for i in range(len(s)):
    if s[i] != T[i]:
      score += 1
  score_list.append(score)
print(min(score_list))
s = list(input())
t = list(input())
l = list()
wake = len(s)-(len(t)-1)

for i in range(wake):
  l.append(s[i:i+len(t)])
gokei = len(t)
for i in l:
  sco = len(t)
  q = 0
  for j in i:
    if j == t[q]:
      sco -= 1
    q += 1
  if gokei < sco:
    gokei = sco
    
print(sco)
s=input()
t=input()
ans=0
for i in range(len(s)-len(t)):
    u=0
    for a,b in zip(t,s[i:len(t)+i]):
        if a==b:u+=1
    ans=max(ans,u)  
print(len(t)-ans)
s = input()
t = input()
import copy
T = copy.deepcopy(t)
count1=0
count2=0
while True:
  if t in s:
    break
  else:
    t= t[:-1]
    count1+=1
while True:
  if T in s:
    break
  else:
    T = T[1:]
    count2+=1
print(min(count1,count2))
def dif (s,t):
    ans=0
    for i in range(len(s)):
        if s[i]!=t[i]:
            ans+=1
    return ans
s=input()
t=input()
k=len(t)
ans=99999999999999999
for i in range(len(s)-k):
    a=s[i:i+k]
    b=dif(a,t)
    ans=min(ans,b)
print (ans)
def main():
    min_num = len(T)
    for i in range(len(S)):
        count = 0
        for j in range(len(T)):
            try:
                if S[i+j] == T[j]:
                    count += 1
            except:
                break
        min_num = min_num if min_num < len(T)-count else len(T)-count
    print(min_num)

S = input()
T = input()
main()
S = input()
T = input()

if T in S:
    print("0")
else:
    slen = len(S)
    tlen = len(T)
    ansCnt = tlen

    for i in range(slen-tlen):
        cnt = 0
        for j in range(tlen):
            if T[j]!=S[i+j]:
                cnt += 1
        
        if ansCnt>cnt:
            ansCnt = cnt

    print(ansCnt)
s = input()
t = input()
x = len(t)
mx= 0
# print(x - mx)

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

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

print(ans)
def resolve():
    s = input()
    t = input()
    ans = 0

    for i in range(len(t)):
        for j in range(i, len(t)):
            test = t[i:j + 1]

            if test in s[i:len(s) - (len(t) - j)-1]:
                ans = max(ans, len(test))

    print(len(t) - ans)

resolve()
s = str(input())
t = str(input())

ans = []
counter = 0
for i, j in zip(s, t):
    if i != j:
        ans.append(j)

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

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

M= len(S)
N = len(T)
ans=0

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

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

Slen = len(S)
Tlen = len(T)
i = 0

while i < Tlen:
    if T[i:] in S[i:]:
        if len(T[i:Tlen-i])< len(S[:(Slen-i)]):
            break
    if T[:(Tlen-i)] in S[:(Slen-i)]:
        break
    i += 1

if i != Tlen:
    print(i)
else:
    print(Tlen)
S=input()
T=input()

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

if(match==0):
    for i in range(len(T)):
        if(T[i] in S):
            match=1

print(len(T)-match)
s, t = input(), input()
b = 1000
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
    a = min(a, b)
print(a)
#!/usr/bin/env python3


s = input()
t = input()

result = len(t)

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

    if result > dif:
        result = dif

print(dif)
S = input()
T = input()
mx = 0
for i in range(len(S)):
    t = 0
    for j in range(len(T)):
        if i + j < len(S) and S[i + j] == T[j]:
            t += 1
    mx = max(mx, t)
print(len(T) - mx)
def main():
    s = input()
    t = input()

    min_v = len(t)

    for i in range(len(t)):
        if t[i:] in s and len(t) - len(t[i:]) < min_v:
            min_v = len(t) - len(t[i:])
        elif t[:i] in s and len(t) - len(t[:i]) < min_v:
            min_v = len(t) - len(t[:i])

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

count = 0
max_count = 0

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

print(len(T) - max_count)
import re
s = input()
t = input()
S = list(s)
T = list(t)
ct = 0
while True:
    m = re.search(t,s)
    if m:
        print(ct)
        exit()
    else:
        ct += 1
        t = t[:-1:]
S = list(input())
T = list(input())
ans = float("inf")
for i in range(len(S)-len(T)):
  n = 0
  for j in range(len(T)):
    if T[j] != S[i+j]:
      n += 1
  ans = min(ans,n)
print(ans)
def main():
    s = input()
    t = input()
    ans = 1e9
    
    for i in range(0,len(s)-len(t)+1):
        cnt = 0
        for j in range(len(t)):
        # for sub_s, sub_t in zip(s[i:len(t)+i],t):
            # if sub_s != sub_t:
            if s[i+j] != t[j]:
                cnt += 1
        ans = min(ans,cnt)
    print(cnt)
    

if __name__ == "__main__":
    main()
s=list(input())
t=list(input())
n=len(t)
m=len(s)
for i in range(n):
    l=n-i
    for j in range(i+1):
        for k in range(j,m-l+1):
            if t[j:j+l]==s[k:k+l]:
                print(i)
                exit()
print(n)
import math

S = str(input())
T = str(input())

cnt = 0
length = 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
    length = min(diff,length)

print(length)
S=input()
T=input()
lenS=len(S)
lenT=len(T)
count=[]

for i in range(lenS-lenT+1):
    c=0
    for j in range(lenT):
        if T[j]!=S[i+j]:
            c=c+1
        j=j+1
        print(c)
    count.append(c)
    i=i+1
print(min(count))
s = input()
t = input()

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

ans = 1000

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

print(ans)
s=input()
t=input()
kotae=0
while t not in s:
  if t in s:
    print(kotae)
    exit()
  else:
    a=t[:-1]
    b=t[1:]
    kotae+=1
    if a in s[:-1] or b in s[1:]:
      print(kotae)
      exit()
    else:
      t=t[1:-1]
      s=s[1:-1]
      kotae+=1
print(kotae)
s=input()
t=input()
a=len(s)
b=len(t)
m=b
for i in range(a-b):
    c=0
    for j in range(b):
        if s[i+j]!=t[j]:
            c+=1;
    if c<m:
        m=c
print(m)
S = input()
T = input()
finish = False
for i in range(len(T)):
    for j in range(i+1):
        A = T[j:j+len(T)-i]
        if (A in S) & (S.find(A) >= j) & (len(S) - (S.find(A)+len(T)-i) >= i-j):
            print(i)
            finish = True
            break
    if finish == True:
        break
s = input()
t = input()
maxi = 0 
for i in range(len(s)):
    maxG = 0
    print(s[i:len(t)+i])
    if len(s[i:len(t)+i]) >= len(t):
        for l, j in zip(s[i:len(t)+i], t):
            if l == j:
                maxG += 1
        maxi = max(maxi, maxG)
    else:
        break
print(len(t)-maxi)
s = input()
t = input()
l = len(t)

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

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

ans = 0

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

print(len_t - ans)
S = input()
T = input()
sl = len(S)
tl = len(T)

for i in range(tl):
    if T[:tl - i] in S[:sl - i]:
        print(i)
        exit()
    elif T[:tl - i] in S[i:sl]:
        print(i)
        exit()
    elif T[i:tl] in S[i:sl]:
        print(i)
        exit()
    elif T[i:tl] in S[:sl - i]:
        print(i)
        exit()
print(tl)
S = input()
T = input()

num = 0
tmp = 0
idx = 0
for i in range(len(S)):
    for j in range(len(T)):
        if(S[i] == T[j]):
            tmp += 1
        else:
            if(tmp > 0):
                num = max(num, tmp)
                tmp = 0
                break

print(len(T)-num)
def main(s: str, t: str):
    ans = [0 for _ in range(len(s))]
    for i, si in enumerate(s):
        for j, tj in enumerate(t):
            print(si, tj, i, j)
            if i - j > 0 and si == tj:
                ans[i-j] += 1

    print(len(t) - max(ans))


if __name__ == '__main__':
    s = input()
    t = input()
    main(s, t)
s = input()
t = input()
l = len(t)
num = 0

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

print(l-num)
S = input()
T = input()

ans = 0xffffffff
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().strip()	 # novel
T = input().strip()  # substring

x = len(T)
ans = len(S)
for i in range(len(S) - x):
  U = S[i:i+x]
  cost = sum(1 if U[k] != T[k] else 0 for k in range(x))
  ans = min(ans, cost)
print(ans)
#!/usr/bin/env python3

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

S = input()
T = input()

lis = list(T)

max_count = 0
for i in range(len(S) - len(T)):
    subS = list(S[i:i+len(T)])
    count = 0
    for j in range(len(T)):
        if subS[j] == T[j]:
            count += 1
    max_count = max(max_count, count)

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

ans = 1000
for i in range(len(S)-len(T)):
    s = S[i:i+len(T)]
    n = 0
    for j in range(len(s)):
        ss = s[j]
        if T[j] != ss:
            n += 1
    ans = min(ans,n)
print(ans)
s = input() # all
t = input() # substring

def calc_length(str1, str2):
    length = 0
    for i in range(len(str1)):
        if str1[i] != str2[i]:
            length += 1
    return length

min_length = len(t)
for i in range(len(s)- len(t)):
    l = calc_length(s[i:i+len(t)], t)
    if l < min_length:
        min_length = l

print(min_length)
s = input()
t = input()

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

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

    mn = 10**5
    for i in range(len(s)-len(t)):
        result = 0
        for j in range(len(t)):
            if s[i+j] != t[j]:
                result += 1
        mn = min(result, mn)
    print(mn)


if __name__ == '__main__':
    main()
import numpy as np
S = np.array(list(input().rstrip()))
T = np.array(list(input().rstrip()))

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

max_count = 0

for i in range(s-t):
  max_count = max(max_count, (S[i:i+t]==T).sum())
      
print(len(T) - max_count)

#print(S[5:5+1])
#print(T[-(10-5):5+1])
#print(S[5:5+1] in T[-(10-5):5+1])
s = input()
t = input()
ans = 10000000
for i in range(len(s)-len(t)):
    tnp = 0
    for j in range(len(t)):
        if (s[j+i]!=t[j]):
            tnp += 1
    ans = min(ans,tnp)
print(ans)
S =input()
T =input()

answer = len(T)
for i in range(len(S)-len(T)+1):
	count = 0
	for j in range(len(T)):
		if S[i + j] != T[j]:
			count = count + 1
	if count < answer:
		answer = count
print(count)
s=input()
t=input()
n=len(s)
k=len(t)
c=n
for i in range(n-k):
  c1=0
  for j in range(i,i+k):
    if(s[j]!=t[j-i]):
      c1+=1
  c=min(c,c1)
print(c)
a = str(input())
b = str(input())

ind = 0
for i in range(len(b)):
  if b[i:len(b)] in a or b[0:len(b)-i] in a:
    ind += 1
print(len(b)-ind)
# -*- coding: utf-8 -*-
s = input()
t = input()

ans = len(t)

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

    ans = min(ans, dif)

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

print(S)
print(T)

lens = len(S)
lent = len(T)

ans = 1000000

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

  if count < ans:
    ans = count
    
print(ans)
def count(s1,s2):
	cnt = 0
	for i in range(len(s2)):
		if s1[i] != s2[i]:
			cnt += 1
	return cnt 


S1 = input()
S2 = input()

mmin = 99999999
for i in range(len(S1)-len(S2)):
	k = count(S2,S1[i:len(S2)+i])
	if k < mmin:
		mmin = k

print(mmin)
s = input()
t = input()
minCount = len(t)
i = 0
while i < len(s):
    countDiff = 0
    j = 0
    while j < len(t) and i+j < len(s):
        if t[j] != s[i+j]:
            countDiff += 1
        j += 1
    minCount = min(countDiff, minCount)
    i += 1
print(minCount)
import sys
s=input()
t=input()
for i in range(len(t)):
    for j in range(len(t)-i):
        for k in range(i,len(s)-len(t[i:len(t)-j])):
            if t[i:len(t)-j]==s[k:k+len(t[i:len(t)-j])]:
                print(len(t)-len(t[i:len(t)-j]))
                sys.exit()
# B Subtring

S = input()
T = input()

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

print(ans)
#d,t,s=map(int,input().split())
s=str(input())
t=str(input())
cans=10000
for i in range(len(s)-len(t)):
  ans=0
  for j in range(len(t)):
    if s[i]!=t[j]:
      ans+=1
    i+=1
  cans=min(ans,cans)
print(cans)
s=input()
t=input()
T,S=len(t),len(s)

ans=T
for i in range(S-T):
    tmp=0
    for c1,c2 in zip(s[i:i+T],t):
        if c1!=c2:
            tmp+=1
    ans=min(ans,tmp)
print(ans)
s = input()
t = input()
slen = len(s)
tlen = len(t)
ans = 10**9
temp = 0

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

print(ans)
import math
min = math.inf
S = input()
T = input()

len_t = len(T)
for s in range(0,len(S)-len_t):
    sub = S[s: s+len_t]
    diff = 0
    for i in range(len_t):
        if sub[i] != T[i]:
            diff += 1
            if diff > min:
                break
    else:
        if diff < min:
            min = diff
print(min)
def judge(s,t):
  if t in s:
    return 0
  for i in reversed(range(len(t))):
    for j in range((len(t)-i)+1):
      if t[0+j:i+j] in s:
        if s.find(t[0+j:i+j])>=j:
          if len(s)-(s.find(t[0+j:i+j])+i)>=len(t)-(i+j):
            print(t[0+j:i+j])
            return len(t)-i

s = input()
t = input()

r = judge(s,t)
print(r)
S = input()
T = input()

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

l = len(T)
for t in range(1,l):
  if (T[t:] in S) or (T[:-1*t] in S):
    ans = t
    break

print(ans)
s,t=open(0).read().split()
res=1001
for i in range(len(s)-len(t)):
  cnt=0
  for j in range(len(t)):
    if s[i+j]==t[j]:
      cnt+=1
  res=min(len(t)-cnt,res)
print(res)
s = input()
t = input()
length = len(t)

for i in range(length):
    if t in s:
        print(i)
        break
    if t[i:length] in s or t[:length-i] in s:
        print(i)
        break
s=input()
t=input()
n=len(s)
m=len(t)
ans=m
for i in range(n-m):
  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()
ans = ''
for i in range(len(t)):
  k = len(t) - i
  if ans == '':
    for j in range(len(s) - k + 1):
      if s[j: j + k] in t and j > t.index(s[j:j + k]):
        ans = len(t) - k
        break      
print(ans)
def func(S,T):
  tlen = len(T)
  min = 1000
  for x in range(0,len(S)-tlen,1):
    tmp = S[x:x+tlen]
    tmpNum = 0
    for i in range(0,len(tmp),1):
      if tmp[i] != T[i]:
        tmpNum += 1
    if min > tmpNum:
      min = tmpNum

  return min

if __name__ == "__main__":
    S = input()
    T = input()
    print(func(S,T))
S = input().rstrip()
T = input().rstrip()
count = 0
lens = len(S)
lent = len(T)
for i in range(lens-lent+1):
    tempcount=0
    for j in range(lent):
        if S[i+j]==T[j]:
            tempcount += 1
    print(tempcount)
    count = max(count,tempcount)

print(lent-count)
s = input()
t = input()

ans = 10000
for i in range(len(s) - len(t) + 1):
    cnt = 0
    for j in range(len(t)):
        if s[i + j] != t[j]: cnt += 1
    ans = min(ans, cnt)
print(cnt)
S = input()
T = input()
t_len = len(T)
count = len(S) - len(T) + 1
max_correct = []
for i in range(count):
  s_tmp = S[i:t_len]
  for n, s in enumerate(s_tmp):
    correct = 0
    if s == T[n]:
      correct += 1
    max_correct.append(correct)
  i = i + 1
  t_len = t_len + 1

print(max(max_correct))
s = input()
t = input()

lendif = len(s) - len(t)

min_global = len(s)

for i in range(lendif):
  beg = i
  end = i + len(t)
  sl = s[beg:end]
  m = 0
  for j in range(len(t)):
    if t[j] != sl[j]:
      m += 1
  if m < min_global:
    min_global = m

print(min_global)
S = input()
T = input()

for i in range(len(T), 0, -1):
    for j in range(len(T)-i):
        subst = T[j:i+j]
        if S.find(subst, j)>=0:
            print (len(T)-i)
            exit(0)
s = input()
t = input()

ans = len(t)

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

ans = 0
if not t in s:
    for i in range(1, len(t)):
        if t[:-i] in s[:-i] or t[i:] in s[i:]:
            ans = i
            break

print(ans)
a = input()
b = input()
mini = len(b)
for s in range(len(a) - len(b)):
  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_list = list(input())
ans = len(t_list)

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

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

s_length = len(s)
t_length = len(t)

ans = 1000

for i in range(s_length - t_length):
  diff = 0
  parts = s[i:t_length+i]
  for j in range(t_length):
    if parts[j] != t[j]:
      diff += 1
  if ans > diff:
    ans = diff

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 s[i+j] != t[j]:
      cnt += 1
  ans = min(ans, cnt)
print(cnt)
s = input()
t = input()

res = 10000000000

for i in range(0, len(s)-len(t)+1):
    m = 0
    # print(s[i:], t)
    # for j, k in zip(s[i:],t):
    #     print(j,k)
    #     if j==k:
    #         m += 1
    for j in range(0, len(t)):
        # print(s[j], t[j])
        if(s[j]==t[j]):
            m+=1
            
    res = min(res, len(t)-m)
    # print(len(t)-m)

print(res)
s = input()
t = input()
ans = len(t)
for i in range(len(s)-len(t)):
    cnt = 0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            cnt += 1
    if ans > cnt:
        ans = cnt
print(ans)
s = input()
t = input()
result = [0]*len(s)
for i in range(len(s)):
    for j in range(len(t)):
        try:
            if s[i+j] == t[j]:
                result[i] += 1
        except:
            pass
print(len(t) - max(result))
s=input()
t=input()
ans=0
for i in range(len(s)-len(t)):
    u=0
    for a,b in zip(t,s[i:len(t)+i]):
        if a==b:u+=1
    print(t,s[i:len(t)+i],u)    
    ans=max(ans,u)  
if len(s)==len(t):
    for a,b in zip(t,s):
        if a==b:ans+=1    
print(len(t)-ans)
S = input()
T = input()
def diff_count(A,B):
    diff = 0
    for a,b in zip(A,B):
        if a!=b:
            diff += 1
    return diff
ans = len(T)
for i in range(len(S) - len(T)):
    temp = S[i:i+len(T)]
    diff_num = diff_count(T,temp)
    ans = min(diff_num,ans)
print(ans)
string1 = input()
string2 = input()

n, m = len(string1), len(string2)
best = float("inf")
for i in range(n - m):
  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()

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

print(num)
s = input()
t = input()
mini = -1 
for i in range(len(s) - len(t)+1):
    temp = 0
    for j in range(len(t)):
        if(s[j + i] != t[j]):
            temp+=1
    if(mini == -1 or temp < mini):
        mini = temp
print(temp)
S = input()
T = input()
# T < S

ans = 10000
for si in range(len(S)-len(T)):
    ic = 0
    for ti in range(len(T)):
        if S[si+ti] != T[ti]:
            ic += 1
    ans = min(ic, ans)
        
print(ans)
S = input()
T = input()

ans = len(T)
for i in range(len(T)):
    for j in range(i+1,len(T)+1):
        if T[i:j] in S:
            if i - S.find(T[i:j]) <= 0 and len(S) - S.find(T[i:j]) - 1 >= len(T) - i - 1:
                ans = min(ans, len(T)-len(T[i:j]))
print(ans)
S = input()
T = input()
A = len(T)
print(len(T))
for i in range(len(T)-1):
    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 > len(T)-i and A > len(T)-i:
        A = len(T)-i 
    M = S.rfind(T[:i])
    if M > len(T)-i and A > len(T)-i:
        A = len(T)-i 
print(A)
S = str(input())
T = str(input())

max_len = 0
for left in range(len(T)):
    for right in range(0, len(T) - left):
        if right == 0:
            tmpT = T[left:]
            tmpS = S[left:]
        else:
            tmpT = T[left:-right]
            tmpS = S[left:-right]
        # print(tmpT, tmpS)
        if tmpT in tmpS:
            max_len = max(len(tmpT), max_len)

print(len(T) - max_len)
S = str(input())
T = str(input())
init = len(T)-1
tmp = init
ans = tmp+1
for i in range(0,len(S)):
    if i > len(S)-len(T):
        break
    for n in range(0, len(T)):
        #print(n)
        if S[i]==T[n]:

            ans =ans -1


            i=i+1
            if ans < tmp:
                tmp =ans

        else:
            ans = init+1
            break


ans = tmp
print(ans)
def judge(s,t):
  if t in s:
    return 0
  for i in reversed(range(len(t))):
    for j in range((len(t)-i)+1):
      if t[0+j:i+j] in s[:-1]:
        if s.find(t[0+j:i+j])>=j:
          return len(t)-i

s = input()
t = input()

r = judge(s,t)
print(r)
#!/usr/bin/env python

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

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

    print(n - c_max)

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

L = 0
judge = False

for i in range(len(T), -1, -1):
    for j in range(len(T)-i):
        if T[j:j+i] in S[j:]:
            L = i
            # print(T[j:j+i])
            judge = True
            break
    if judge:
        break

print(len(T)-L)
s=input()
t=input()
ls=len(s);lt=len(t)
ans=10000
for i in range(ls-lt):
    ss=list(s[i:i+lt])
    tt=list(t)
    
    tmp=[tt[j] for j in range(lt) if tt[j]!=ss[j]]
    ans=min(ans,len(tmp))
print(ans)
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

s = [_ for _ in input()]
t = [_ for _ in input()]

ans = 10**10

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