Problem:
 Score : 200 points    Problem Statement Given are two strings S and T .  Let us change some of the characters in S so that T will be a substring of S .  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, xxx is a substring of yxxxy , but not a substring of xxyxx .      Constraints  The lengths of S and T are each at least 1 and at most 1000 .  The length of T is at most that of S .  S and T consist of lowercase English letters.         Input Input is given from Standard Input in the following format:  S  T       Output Print the minimum number of characters in S that need to be changed.        Sample Input 1 cabacc
abc      Sample Output 1 1  For example, changing the fourth character a in S to c will match the second through fourth characters in S to T .  Since S itself does not have T as its substring, this number of changes - one - is the minimum needed.       Sample Input 2 codeforces
atcoder      Sample Output 2 6

Solution (Python):

S= list(input())
T= list(input())

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

print(len(T) - ans)

Solution (Python):
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)

Solution (Python):
s = str(input())
t = str(input())

l_st = len(s) - len(t) + 1
l_t = len(t)

ans = l_t
for _ in range(l_st):
    mx = l_t
    for i in range(l_t):
        if s[_+i] == t[i]:
            mx -= 1
        ans = min(ans, mx)
print(ans)

Solution (Python):
S = input()
T = input()
S_len = len(S)
T_len = len(T)
ans = 10 ** 5
for i in range(S_len - T_len + 1):
    t = 0
    for j in range(T_len):
        s = S[i:i+T_len]
        if s[j] != T[j]:
            t += 1
    ans = min(ans, t)
print(ans)

Solution (Python):
S = input()
T = input()
def count(x, y):
    cnt = 0
    for i in range(len(x)):
        if x[i] == y[i]:
            cnt += 1
    return cnt

ans = 0
l_T = len(T)
l_S = len(S)
for i in range(l_S - l_T + 1):
    tmp_str = S[i:i+l_T]
    tmp_ans = count(T, tmp_str)
    ans = max(ans, tmp_ans)
ans = l_T - ans
print(ans)

Solution (Python):
import sys
readline = sys.stdin.readline

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

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

Solution (Python):
S = input()
T = input()

ans = len(T)

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

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

if __name__ == "__main__":
  count = 1001
  s = input()
  t = input()
  if(len(s) == len(t)):
    count = min(count,diff(s,t))
  for i in range(len(s)-len(t)):
    count = min(count,diff(s[i:i+len(t)],t))
  print(count)

Solution (Python):
S=input()
T=input()

ans=len(S)
for i in range(len(S)):
    if len(S)-i<len(T):
        break
    tmp = 0
    for j in range(len(T)):
        tmp += not T[j]==S[i+j]
    ans = min(ans,tmp)

print(ans)

Solution (Python):
s=input()
t=input()

l=len(s)-len(t)
mindiff=float("inf")
for i in range(l+1):
  ss=s[i:i+len(t)]
  cnt=0
  for j,c in enumerate(t):
    if ss[j]!=c:
      cnt+=1
  mindiff=min(mindiff,cnt)
print(mindiff)

Solution (Python):
s = input()
t = input()
ans = len(t)

def judge(s0, s1):
    ret = 0
    for i in range(len(s0)):
        if s0[i] != s1[i]:
            ret += 1
    return ret

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

print(ans)

Solution (Python):
s = input()
t = input()
c = 0
for i in range(len(s)-len(t)+1):
    cc = 0
    for j in range(len(t)):
        if t[j] == s[i+j]:
            cc += 1
    if cc >= c:
        c = cc
    cc = 0
print(len(t)-c)

Solution (Python):
s = input()
t = input()
slen = len(s)
tlen = len(t)
min_diff = tlen

for si in range(slen - tlen + 1):
    diff = 0
    for ti in range(tlen):
        if s[si+ti] != t[ti]:
            diff += 1
    if diff < min_diff:
        min_diff = diff

print(min_diff)

Solution (Python):
s = input()
t = input()


ans = 1000

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)

Solution (Python):
def main():
    S=list(input())
    T=list(input())

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

    print(res)

if __name__=="__main__":
    main()

Solution (Python):
s = input()
t = input()
n = len(s)
m = len(t)

ans = n
for i in range(n-m+1):
    ts = s[i:i+m]
    tmp = 0
    for tss,tt in zip(ts,t):
        if tss != tt:
            tmp += 1
    ans = min(ans,tmp)

print(ans)

Solution (Python):
S=input()
T=input()

ls=len(S)
lt=len(T)
commons=[]

for i in range(ls-lt+1):
    x=S[i:i+lt]
    count=0
    for j in range(lt):
        if x[j]==T[j]:
            count+=1
    commons.append(lt-count)
    
print(min(commons))

Solution (Python):
import numpy as np

s = input()
t = input()

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

ma = 0
for i in range(len_s - len_t + 1):
    ma = max(ma, np.sum(np.array(list(s[i: i + len_t])) == np.array(list(t))))

ans = len_t - ma

print(ans)

Solution (Python):
S = input()
T = input()
t = len(T)
def check(a,b):
    temp = 0
    for i in range(len(a)):
        if a[i] != b[i]:
            temp += 1
    return temp

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

print(ans)

Solution (Python):
s=str(input())
t=str(input())
lens=len(s)
lent=len(t)
cnt=1000
for i in range(lens-lent+1):
  temp=0
  for j in range(lent):
    if t[j]!=s[i+j]:
      temp+=1
  if temp<cnt:
    cnt=temp
print(cnt)

Solution (Python):
from math import inf


def main():
    s = input()
    t = input()
    tlen = len(t)
    min = inf
    for i in range(len(s) - tlen + 1):
        count = 0
        for j, c in enumerate(s[i:i + tlen]):
            if not t[j] == c:
                count += 1
        if count < min:
            min = count
    print(min)


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
T = input()
L,l = len(S),len(T)
ans = 1000
for i in range(l,L+1):
    s = S[i-l:i]
    cnt = 0
    for j in range(l):
        if s[j] != T[j]:
            cnt += 1
    if ans > cnt:
        ans = cnt
print(ans)

Solution (Python):
S = input()
T = input()

diff = len(S) - len(T)
ans = 99999

for i in range(diff + 1):
  t_s = len(T)
  moto = S[i:i+t_s]
  saki = T

  num = 0
  for j in range(len(T)):
    if moto[j] != saki[j]:
      num = num + 1

  if num <= ans:
    ans = num

print(ans)

Solution (Python):
S=list(input())
T=list(input())
cnt=0
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
	cnt=max(a,cnt)
print(len(T)-cnt)

Solution (Python):
S=input()
T=input()

min_cnt=1000
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
    min_cnt=min(min_cnt,cnt)

print(min_cnt)

Solution (Python):
S = input()
T = input()

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

ans = len(T) - max(Counts)
print(ans)

Solution (Python):
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)

Solution (Python):
s = input()
lens = len(s)
t = input()
lent = len(t)
ss = set()
for i in range(lens - lent + 1):
    ss.add(s[i:i+len(t)])
ans = float('inf')

for text in ss:
    tmp = 0
    for i in range(lent):
        if text[i] != t[i]:
            tmp += 1
    ans = min(ans,tmp)

print(ans)

Solution (Python):
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();

Solution (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()

Solution (Python):
S = str(input())
T = str(input())
ans = 1000
for i in range(len(S) - len(T) + 1):
    c = 0
    for j in range(len(T)):
        if S[i] != T[j]:
            c += 1
        i += 1
    ans = min(ans, c)
print(ans)

Solution (Python):
S = input()
T = input()

answer = 100000
for i in range(len(S) - len(T) + 1):
    distance = 0
    for j in range(len(T)):
        if S[i + j] != T[j]:
            distance += 1
    if answer > distance:
        answer = distance
print(answer)

Solution (Python):
S = input()
T = input()


patan = len(S)-len(T)+1
min_change = 1000
for p in range(patan):
  S_sub = S[p:p+len(T)]
  not_match = len([1 for s,t in zip(S_sub, T) if s!=t])
  if not_match < min_change:
    min_change = not_match

print(min_change)

Solution (Python):
S=input()
T=input()
C=[]
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
    C.append(cnt)
print(len(T)-max(C))

Solution (Python):
import sys
sys.setrecursionlimit(10**6)




s = input()
t = input()







s = [ch for ch in s]
t = [ch for ch in t]

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

Solution (Python):
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)

Solution (Python):
s = input()
t = input()
m = 0
ans = 0
for i in range(len(s)-len(t)+1):
    c = 0
    for j in range(len(t)):
        if s[i+j] == t[j]:
            c += 1
    if c >= m:
        m = c
        ans = len(t) - c

print(ans)

Solution (Python):
s=input()
t=input()
k=0
for i in range(len(s)-len(t)+1):
  a=s[i:len(t)+i]
  kari=0
  for j in range(len(t)):
    if a[j]==t[j]:
      kari+=1
  k=max(kari,k)
print(len(t)-k)

Solution (Python):
s = input()
t = input()
t_len =	len(t)

s_len =	len(s)
max=10000
for i in range(s_len-t_len+1):
  c=0
  for j in range(t_len):
    if s[i+j]!=t[j]:
      c+=1
  if c < max:
    max=c

print(max)

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

    slen = len(s)
    tlen = len(t)
    
    ans = 10 ** 10

    for i in range(slen - tlen+1):
        tmp = 0
        for j in range(tlen):
            if s[i+j] != t[j]:
                tmp += 1
        if ans > tmp:
            ans = tmp
    print(ans)




if __name__ == "__main__":
    main()

Solution (Python):
s = input()
t = input()

res = []

x, y = len(s), len(t)
for i in range(0, x):
	c = 0
	sub = s[i:i+y]
	if len(sub) == y:
		for a, b in zip(sub, t):
			if a != b:c+=1
		res += [c]
	else:
		break
print(min(res))

Solution (Python):
S = input()
T = input()

min_count = 10000
for i in range(len(S)):
    count = 0
    check = False
    for j in range(len(T)):
        if i + j == len(S):
            check = True
            break
        if S[i + j] == T[j]:
            continue
        else:
            count += 1
    
    if check:
        break

    min_count = min(count, min_count)
print(min_count)

Solution (Python):
S=input()
T=input()
ans=float("inf")
for i in range(len(S)-len(T)+1):
    tmp=0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            tmp+=1
    ans=min(ans,tmp)
print(ans) if ans<float("inf") else print(len(T))

Solution (Python):
import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    S = input().strip()
    T = input().strip()

    res = len(T)
    for i in range(len(S) - len(T) + 1):
        res = min(res, sum(1 if s != t else 0 for s, t in zip(S[i:], T)))

    print(res)

if __name__ == "__main__":
    main()

Solution (Python):
a=input()
b=input()
al=len(a)
bl=len(b)
mn=1000
cnt=0
for i in range(0,al-bl+1):
    cnt=0
    for j in range(0,bl):
        if a[i+j]!=b[j]:
            cnt=cnt+1
    if mn>cnt:
        mn=cnt
print(mn)

Solution (Python):
s = input()
t = input()

min=1000

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

print(min)

Solution (Python):
s = input()
t = input()

cnt = 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
    
    if cnt < tmp:
        cnt = tmp

print(len(t)-cnt)

Solution (Python):
S=list(map(str,input()))
T=list(map(str,input()))




s=len(S)
t=len(T)
m=1001;e=0
for i in range(s-t+1):
  
  for j in range(t):
    if S[i+j]!=T[j]:
      e=e+1
  if e<m:
    m=e
  e=0
print(m)

Solution (Python):
s = input()
t = input()

count = len(s) - len(t) + 1
ans = 10**6
for i in range(count):
    a = 0
    for j in range(len(t)):
        
        if s[j+i] != t[j]:
            a += 1
    if a < ans:
        ans = a
print(ans)

Solution (Python):


import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        for line in sys.stdin:
            lines.append(line.strip())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    s = lines[0]
    t = lines[1]

    return (s, t)


def solve(s, t):


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

        if cnt < count:
            count = cnt 


    return count


def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Solution (Python):
S = str(input())
T = str(input())
ans = 1001
for i in range(len(S)-len(T)+1):
    S_t = S[i:i+len(T)]
    count = 0
    for j in range(len(T)):
        if S_t[j]!=T[j]:
            count +=1
    ans = min(count,ans)
print(ans)

Solution (Python):
import sys
s = input()
t = input()
if t in s:
    print(0)
    sys.exit()

lenS = len(s)
lenT = len(t)

ans = lenT

for i in range(lenS-lenT+1):
    ss = s[i:i+lenT]
    num = 0
    for j in range(lenT):
        if ss[j] != t[j]:
            num += 1
    
    ans = min(num, ans)

print(ans)

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

    c = 0
    ans = len(t)
    for i in range(len(s)-len(t)+1):
        c = 0
        now = i
        for tt in t:
            if s[now] != tt:
                c += 1
            now += 1
        ans = min(ans,c)
    print(ans)
if __name__=='__main__':
    main()

Solution (Python):
s = input()
t = input()
if len(s) == len(t):
  a = 0
  for i in range(len(t)):
    if s[i] == t[i]:
      a+=1
  print(len(s)-a)
  exit(0)
g = []
for i in range(len(s)-len(t)):
  n = 0
  for j in range(len(t)):
    if s[i+j]==t[j]:
      n+=1
  g.append(len(t)-n)
print(min(g))

Solution (Python):
S = input()
T = input()

ans = len(T)
num = len(S)-len(T)+1
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)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = 10**6
mod = 10 ** 9 + 7 

from decimal import *



S = list(input())
T = list(input())

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

Solution (Python):
s = list(input())
t = list(input())

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

print(ans)

Solution (Python):
S=input()
T=input()
ans=0
for i in range(len(S)-len(T)+1):
    
    cnt=0
    for j in range(len(T)):
        if S[i+j]==T[j]:
            cnt+=1
    if ans<cnt:
        ans=cnt
print(len(T)-ans)

Solution (Python):
S = str(input())
T = str(input())

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

print(ans)

Solution (Python):

import numpy as np
s = np.array(list(input()))
t = np.array(list(input()))

t_len = len(t)
chk_num = len(s) - t_len

change_num = t_len
for i in range(chk_num + 1):
    tmp = t_len - np.count_nonzero(s[i: t_len + i] == t)
    change_num = min(tmp, change_num)

print(change_num)

Solution (Python):
S = input()
T = input()

result = float("inf")
count = len(S) - len(T) + 1

for i in range(count):
    tmp = 0
    for j in range(len(T)):
        if T[j] != S[i+j]:
            tmp += 1
    result = min(result, tmp)

print(result)

Solution (Python):
s = input()
t = input()
count = []
correct = 0
for i in range(len(s) - len(t) + 1):
  for j in range(len(t)):
    if s[i+j] == t[j]:
      correct += 1
  count.append(correct)
  correct = 0
print(len(t) - max(count))

Solution (Python):


import math
import re
import numpy as np
import copy


S = input()
T = input()

ans = len(S)


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

    if cnt < ans:
        ans = cnt

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

    ans = cnt

print(ans)

Solution (Python):
s = input()
t = input()
len_s = len(s)
len_t = len(t)
ans = float("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
    ans = min(cnt, ans)
print(ans)

Solution (Python):
S=input()
T=input()
ns=len(S)
nt=len(T)
ans=ns
for i in range(ns-nt+1):
    count=0
    for j in range(nt):
        if S[i+j]==T[j]:
            count+=1
    ans=min(nt-count,ans)
    
print(ans)

Solution (Python):
S=str(input())
T=str(input())
ls=len(S)
lt=len(T)
m=0
for i in range(ls-lt+1):
  A=S[i:i+lt]
  a=0
  for s,t in zip(A,T):
    if s==t:
      a+=1
  m=max(m,a)
print(lt-m)

Solution (Python):
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)+1):
  a = 0
  for j in range(len(t)):
    if s[i+j] != t[j]:
      a+=1
  ans = min(a,ans)
print(ans)

Solution (Python):
A=list(input())
B=list(input())
lengthA=len(A)
lengthB=len(B)
maxi=[]
for i in range(lengthA-lengthB+1):
	counter=0
	C=A[i:lengthB+i]
	for j in range(lengthB):
		if C[j]==B[j]:
			counter+=1
	maxi.append(lengthB-counter)
print(min(maxi))

Solution (Python):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 100000
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

s = X()
t = X()

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

print(cnt)

Solution (Python):

S = input()
T = input()

myans = float('INF')
for s in range(len(S) - len(T)+1 ):
    mycnt = 0
    for t in range(len(T)):
        
        if S[s+t] != T[t]:
            mycnt += 1
    if mycnt < myans:
        myans = mycnt
print(myans)

Solution (Python):
S = input()
T = input()
ans = []
for i in range(len(S)-len(T)+1):
  ans.append(S[i:len(T)+i])
s = []

for i in ans:
  count = 0
  for k in range(len(T)):
    if i[k]==T[k]:
      count+=1
  s.append(count)
  
print(len(T)-max(s))

Solution (Python):
s = input()
t = input()

ls = len(s)
lt = len(t)
max = 0
for i in range(ls-lt+1):
  k = 0
  for j in range(i,i+lt):
    if s[j] == t[j-i]:
      k += 1
  if max < k:
    max = k
    
print(lt-max)

Solution (Python):








s = input()
t = input()

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

print(min(ans))

Solution (Python):
import sys,bisect

from sys  import stdin,stdout

from bisect import bisect_left,bisect_right,bisect,insort,insort_left,insort_right

from math import gcd,ceil,floor,sqrt

from collections import Counter,defaultdict,deque,OrderedDict

dx=[-1,1,0,0]
dy=[0,0,1,-1]


sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 998244353
mod = 10**9+7

def isPrime(n):
    if (n <= 1) :return False
    if (n <= 3) :return True
    if (n%2 == 0 or n%3 == 0):return False
    for i in range(5,ceil(sqrt(n))+1,6):
        if (n%i==0 or n%(i+2)==0):
            return False
    return True

def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")


def soe(limit):
    l=[1]*(limit+1)
    l[0]=0
    l[1]=0
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0
    
    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

                
def gcd(a,b):
    while b:
        a=a%b
        b,a=a,b
    return a

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r
    
def solve():
    s=input()
    t=input()
    ans=float('inf')
    i=0
    while i<len(s)-len(t)+1:
        x=0
        c=0
        j=i
        
        while x<len(t):
            
            if t[x]!=s[i+x]:
                c+=1
            j+=1
            x+=1
        
        ans=min(ans,c)
        i+=1
    print(ans)
        


for _ in range(1):
    solve()

Solution (Python):
s = input().rstrip()
t = input().rstrip()
ns = len(s)
nt = len(t)
ans = ns
for i in range(ns-nt+1):
    tmp = s[i:i+nt]
    n=0
    for j in range(nt):
         if tmp[j]!=t[j]:
                n+=1
    if ans>n:
        ans=n
print(ans)

Solution (Python):
s = str(input())
t = str(input())

mi = 100000
l_s = len(s)
l_t = len(t)

for i in range(l_s-l_t+1):
    sub = s[i:i+l_t]
    d = 0
    for j in range(l_t):
        if sub[j] is not t[j]:
            d += 1
    if d < mi:
        mi = d

print(mi)

Solution (Python):
s = input()
t = input()

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

Solution (Python):
S=input()
T=input()
x=0
for i in range(len(S)-len(T)+1):
  y=0
  for j in range(len(T)):
    if S[i+j]==T[j]:
      y+=1
  if y>x:
    x=y
print(len(T)-x)

Solution (Python):
S = input()
T = input()

ans = 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
    ans = max(ans, tmp)
print(len(T) - ans)

Solution (Python):
import numpy as np
S = np.array(list(input()))
T = np.array(list(input()))

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


max_kasanari = np.sum(S[:lenT] == T)  
for i in  range(lenS - lenT + 1):
    kasanari = np.sum(S[i:lenT+i] == T)
    if max_kasanari < kasanari:
        max_kasanari = kasanari

print(lenT - max_kasanari)

Solution (Python):
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())

Solution (Python):
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+1):
    a=s[i:i+k]
    b=dif(a,t)
    ans=min(ans,b)
print (ans)

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

Solution (Python):
Y = input().strip()
X = input()
X_len = len(X)
ss = 100000
for i in range(len(Y) - X_len + 1):
    s = 0
    for j in range(X_len):
        if Y[i + j] != X[j]:
            s += 1
    ss = min(ss, s)
print(ss)

Solution (Python):
s=input()
t=input()
lent = len(t)

ans = lent
cnt = 0

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

print(ans)

Solution (Python):
s = input()
t = input()
n = len(t)
ans = []
def f(i):
  sum = 0
  for ch1, ch2 in zip(s[i: i+n], t):
    if ch1 != ch2:
      sum += 1
  return sum
for i in range(len(s)-n+1):
  ans.append(f(i))

print(min(ans))

Solution (Python):
s=input()
t=input()

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

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

Solution (Python):


S = input()
T = input()
s = len(S)
t = len(T)
ans = t
for i in range(s-t+1):
    cnt = 0
    tmp = S[i:t+i]

    for j in range(t):
        if T[j] == tmp[j]:
            cnt += 1
        ans = min(ans, (t-cnt))
print(ans)

Solution (Python):

S=input()
T=input()
ans = float('inf')
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,cnt)
print(ans)

Solution (Python):
S, T = input(), input()
def different(A, B):
    res = 0
    for a, b in zip(A, B):
        if a != b:
            res += 1
    return res

lenS = len(S)
lenT = len(T)
Change = [different(S[i:i+lenT], T) for i in range(lenS-lenT+1)]
print(min(Change))

Solution (Python):


import copy
import random
import bisect 
import fractions 
import math
import sys
import collections
from decimal import Decimal 

mod = 10**9+7
sys.setrecursionlimit(mod) 

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

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

max_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

        
    max_cnt = max(cnt, max_cnt)

print(len(T) - max_cnt)

Solution (Python):
s= input()
t =  input()
n =  len(s)
n1 = len(t)
ans= 100000
for i in range(n-n1+1):
    count= 0
    for j in range(n1):
        
        if s[i+j]==t[j]:
            continue
        else:
            count+=1
    
    ans = min(ans,count)
print(ans)

Solution (Python):
s = input()
t = input()
ans = float('inf')
for i in range(len(s)-len(t)+1):
    c = 0
    for j in range(len(t)):
        
        if s[i+j] != t[j]:
            c+=1
    
    ans = min(ans,c)
    
print(ans)

Solution (Python):
S = input()
SS = list(S)
T = input()
TT = list(T)
X = len(SS) -len(TT)
mini = 1000
for i in range(X+1):
  count = 0
  for j in range(len(TT)):
    if SS[j + i] != TT[j]:
      count +=1
  if count < mini:
    mini = count
print(mini)

Solution (Python):

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

ans = 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 += 1
    if (ans > count):
        ans = count

print(ans)

Solution (Python):
s = input()
t = input()

slen=len(s)
tlen=len(t)
diffmin=99999

for iis in range(0,slen-tlen+1):
  diff=0
  for iit in range(0,tlen):
    if (s[iis+iit] != t[iit]):
      diff+=1
  diffmin=min(diffmin, diff)
print(diffmin)

Solution (Python):
S = input()
T = input()

Tn = len(T)
best = 0
for s in range(len(S)-len(T)+1):
    count = 0
    for t in range(Tn):
        if S[s+t] == T[t]:
            count += 1
    if count > best:
        best = count

print(Tn-best)

Solution (Python):
S = input()
T = input()

ans = 9999

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

Solution (Python):
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)

Solution (Python):
S = list(input())
T = list(input())

ans = 10**9

for i in range(len(S)-len(T)+1):
    Spart = S[i:i+len(T)]
    
    temp_ans = 0
    
    for j in range(len(T)):
        
        if Spart[j] != T[j]:
            temp_ans += 1
            
    if temp_ans < ans:
        ans = temp_ans
        
print(ans)

Solution (Python):
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)

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

ans=10**10

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