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):


import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    S, T = sys.stdin.read().split()

    ls, lt = len(S), len(T)
    ans = lt
    for i in range(ls - lt+1):
        x = 0
        for j in range(lt):
            if S[i+j] == T[j]:
                continue
            x += 1
            if x > ans:
                break
        else:
            if x < ans:
                ans = x

    print(ans)

if __name__ == "__main__":
    resolve()

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

dismatch = []
for sx in range(len(s)-len(t)+1):
    tmp = 0
    for tx in range(len(t)):
        if s[sx+tx] != t[tx]:
            tmp += 1
    dismatch.append(tmp)
print(min(dismatch))

Solution (Python):
S = list(input())
T = list(input())
ls = len(S)
lt = len(T)
ans = lt
for offset in range(ls - lt + 1):
	cnt = 0
	for i in range(lt):
		if S[offset + i] != T[i]:
			cnt += 1
	ans = min(ans, cnt)
print(ans)

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

max=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 count > max:
        max=count
        
print(len(t)-max)

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

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


def count_diff(s_bubun, t_all):
    cnt = 0
    for i in range(len(s_bubun)):
        if s_bubun[i] != t_all[i]:
            cnt += 1
    return cnt


i = 0
len_t = len(T)
ans = 10**10
while i+len_t <= len(S):
    s_bubun = S[i:i+len_t]
    kouho = count_diff(s_bubun, T)
    ans = min(kouho, ans)
    i += 1

print(ans) if ans != 10**10 else print(0)

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

def num_replace(string, sub, shift):
    ans = 0
    for i in range(len(sub)):
        if string[i + shift] != sub[i]:
            ans += 1
    return ans


min_num = float("inf")
for shift in range(0, len(s) - len(t) + 1):
    min_num = min(min_num, num_replace(s, t, shift))
print(min_num)

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


min_diff = 10000
window = len(T)
for i in range(0, len(S) - window + 1):
    x = S[i: i+window]
    count = 0
    for a, b in zip(T, x):
        if a != b:
            count += 1
    min_diff = min(count, min_diff)
print(min_diff)

Solution (Python):
s = input()
t = input()
ans = 100000
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)

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

counters = []
for i in range(len(s) - len(t) + 1):
  part_of_s = s[i: i + len(t)]
  counter = 0
  for sss, ttt in zip(part_of_s, t):
    if sss != ttt:
      counter += 1
  counters.append(counter)
print(min(counters))

Solution (Python):
def main():
    s = list(input())
    t = list(input())
    lt = len(t)
    ls = len(s)
    ans = 1000
    
    
    def dis(a, b):
        d = 0
        for ai, bi in zip(a, b):
            if ai == bi:
                continue
            d += 1
        return d
    
    for i in range(ls-lt+1):
        ans = min(ans, dis(s[i:i+lt], t))
    
    print(ans)
        
    

if __name__ == "__main__":
    main()

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

tl = len(T)

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

print(tl-ans)

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

len_diff = len(S) - len(T)

min_diff = len(S)

for i in range(len_diff + 1):
    s = S[i:i+len(T)]
    diff = 0
    for j in range(len(T)):
        if s[j] != T[j]:
            diff += 1
    min_diff = min(min_diff, diff)
    
print(min_diff)

Solution (Python):
a,b = open(0).read().split()
na = len(a)
nb = len(b)

ans = float('inf')
for i in range(na-nb+1):

    tmp = nb
    for j in range(nb):
        if a[i+j] == b[j]:
            tmp -= 1
    ans = min(ans, tmp)

print(ans)

Solution (Python):
s = list(input())
t = list(input())
start = 0
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 = count + 1
  if max_count < count:
    max_count = count
  count = 0
ans = len(t) -max_count
print(ans)

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

Solution (Python):
s=list(input())
t=list(input())
r=0
for c in range(len(s)-len(t)+1):
    x=0
    for d in range(len(t)):
        if s[c+d]==t[d]:
            x+=1
    if x>r:
        r=x
print(len(t)-r)

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

ans = 2000  
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(diff, ans)

print(ans)

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

ans = len(s)
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)

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

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

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

result = 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
    result = max(result, cnt)
        
print(len(t) - result)

Solution (Python):
import math


def distance(s, t):
    assert len(s) == len(t)

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

    return cnt


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

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

    print(dist)


if __name__ == '__main__':
    main()

Solution (Python):
s=input()
t=input()
ans=len(t)
for i in range(len(s)-len(t)+1):
    count=0
    for j in range(0,len(t)):
        if s[i+j]!=t[j]:
            count+=1
    if count<ans:
        ans=count
print(ans)

Solution (Python):

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

    ans = 10 ** 6
    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)


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
T = input()
def same(U):
    k = 0
    for i in range(len(U)):
        if U[i] == T[i]:
            k += 1
    return k
ans = 0
for i in range(len(S)-len(T)+1):
    ans = max(ans,same(S[i:i+len(T)]))
print(len(T)-ans)

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

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

print(min(cnt))

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

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

l1 = len(S)
l = len(T)

min_ = float('inf')

for i in range(l1 - l + 1):
    cnt = 0

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

    min_ = min(min_, cnt)

print(min_)

Solution (Python):
def main():
    s = input()
    t = input()
    
    n = len(t)
    ans = n
    if len(s)==n:
        temp = 0
        for i in range(n):
            if s[i] != t[i]:
                temp+=1
        ans = temp

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

        if ans > temp:
            ans = temp
    
    print(ans)
main()

Solution (Python):
def solution(s,t):
    minv = float("inf")
    for i in range(len(s) - len(t) + 1):
        v = 0
        for j in range(len(t)):
            if s[i + j] != t[j]:
                v += 1
        minv = min(minv, v)
    return minv

s = input()
t = input()
print(solution(s, t))

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

sl = len(s)
tl = len(t)

out = tl
for i in range(sl - tl + 1):
    sub = s[i:i + tl]
    d = 0
    for j, k in zip(sub, t):
        if j != k:
            d += 1
    out = min(out, d)
print(out)

Solution (Python):


import sys


INF = sys.maxsize // 10


def minimize(s, t):
    ns = len(s)
    nt = len(t)
    res = INF
    for start_idx in range(ns - nt + 1):
        cand = sum(c != d for c, d in zip(s[start_idx: start_idx + nt], t))
        res = min(res, cand)
    return res


def main():
    s = input()
    t = input()
    print(minimize(s, t))


if __name__ == '__main__':
    main()

Solution (Python):
s = str(input())
t = str(input())
n_s = len(s)
n_t = len(t)

count = n_t
for i in range(n_s-n_t+1):
  tmp = 0
  for s1, s2 in zip(s[i:n_t+i], t):
    if s1 != s2:
      tmp += 1
  if count > tmp:
    count = tmp
print(count)

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

Solution (Python):
def read():
    S = input()
    T = input()
    return S, T


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

def func(S, T):
    lt = len(T)
    ans = lt
    for i in range(len(S) - len(T) + 1):
        d = diff(T, S[i:i+lt])
        if d < ans:
            ans = d
    return ans


if __name__ == '__main__':
    S, T = read()
    print(func(S, T))

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

slen = len(S)
tlen = len(T)

maxnum = -1
for i in range(slen-tlen+1):
    match = 0
    for j in range(tlen):
        if S[i+j] == T[j]:
            match += 1
    if maxnum < match:
        maxnum = match

print(tlen - maxnum)

Solution (Python):




S = input()
T = input()

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

Solution (Python):

import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1  
MOD = 10 ** 9 + 7


def debug(*x):
    print(*x, file=sys.stderr)


def solve(S, T):
    buf = []
    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
        buf.append(diff)
    return min(buf)


def main():
    
    S = input().strip()
    T = input().strip()
    print(solve(S, T))



T1 = """
cabacc
abc
"""
TEST_T1 = """
>>> as_input(T1)
>>> main()
1
"""

T2 = """
codeforces
atcoder
"""
TEST_T2 = """
>>> as_input(T2)
>>> main()
6
"""

T3 = """
aaa
bbb
"""
TEST_T3 = """
>>> as_input(T3)
>>> main()
3
"""


def _test():
    import doctest
    doctest.testmod()
    g = globals()
    for k in sorted(g):
        if k.startswith("TEST_"):
            doctest.run_docstring_examples(g[k], g, name=k)


def as_input(s):
    "use in test, use given string as input file"
    import io
    f = io.StringIO(s.strip())
    g = globals()
    g["input"] = lambda: bytes(f.readline(), "ascii")
    g["read"] = lambda: bytes(f.read(), "ascii")


input = sys.stdin.buffer.readline
read = sys.stdin.buffer.read

if sys.argv[-1] == "-t":
    print("testing")
    _test()
    sys.exit()

main()

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

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

m = len(T)

for i in range(len(S)-len(T)+1):
    m = min(m, len(T) - equal(T,S[i:i+len(T)]))

print(m)

Solution (Python):
import math

s = input()
t = input()

ans = len(t)
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, t = input(), 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)

Solution (Python):
def hw(a,b):
  w = 0
  for i,j in zip(a,b):
    
    if i == j:
      w+=1
  return w

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

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

res = 10**6
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
    res = min(res, val)
print(res)

Solution (Python):
s=input()
t=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):









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

    S_ary = list(S)
    T_ary = list(T)

    diff = len(S_ary) - len(T_ary) + 1
    tLen = len(T_ary)

    minCounter = 1000
    for i in range(diff):
        tempS = S_ary[i : i + tLen]

        counter = 0
        for charIndex in range(tLen):
            if tempS[charIndex] != T_ary[charIndex]:
                counter += 1
        minCounter = min(minCounter, counter)

    print(minCounter)


if __name__ == "__main__":
    main()

Solution (Python):
s = input()
t = input()
ans = []
for i in range(len(s)-len(t) + 1):
  s_i = s[i:i+len(t)]
  count_diff = 0
  for t_j, s_j in zip(t, s_i):
    if t_j != s_j:
      count_diff += 1
  ans.append(count_diff)
print(min(ans))

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

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

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

            tmp += 1
    result.append(tmp)

print(len(t)-max(result))

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

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

ans = []

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

print(min(ans))

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

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

print(ans)

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

Solution (Python):
s=input()
t=input()
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
    ans=min(ans,tmp)
print(ans)

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

Solution (Python):
s = input()
t = input()
ls = len(s)
lt = len(t)
res = 0
for i in range(ls - lt + 1):
    tmp = 0
    for j in range(lt):
        if s[i + j] == t[j]:
            tmp += 1
    res = max(res, tmp)
print(lt - res)

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

s_n = len(s)
t_n = len(t)

ans = 1200
for i in range(s_n - t_n + 1):
    cnt = 0
    for j in range(t_n):
        if s[i + j] != t[j]:
            cnt += 1
    ans = min(ans, cnt)
    
print(ans)

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

size = len(t)
ms = []
for i in range(len(s)-size+1):
    
    m = sum([a==b for a,b in zip(s[i:i+size], t)])
    ms.append(m)

print(size - max(ms))

Solution (Python):
s=input()
t=input()
li=[]
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
    li.append([count,i])
li=sorted(li)
print(li[0][0])

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

mincount = 9999

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

print(mincount)

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

Solution (Python):
s = input()
t = input()
ans = float('inf')
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)

Solution (Python):
def equ(a, b):
    if a == b:
        return 1
    else:
        return 0


s = input()
t = input()
max_equ = 0

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

Solution (Python):
def main():
    s = input()
    t = input()
    length = len(t)
    mn = 9999
    for i in range(len(s) - length+1):
        counter = 0
        temp = s[i:i+length]
        
        for j,c in enumerate(temp):
            if t[j] != c:
                counter += 1
        mn = min(mn,counter)
    print(mn)
if __name__ == '__main__':
    main()

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


def main(input, print):
    S = list(input().strip())
    T = list(input().strip())
    tt = 0
    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
        tt = max(tt, t)
    print(len(T)-tt)


if __name__ == '__main__':
    main(sys.stdin.readline, print)

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

Solution (Python):

import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"






s = input()
t = input()
n = len(s)
m = len(t)
ans = -float("inf")
for i in range(n-m+1):
	temp = 0
	for j in range(i,i+m):
	
		if t[j-i]==s[j]:
			temp+=1
	
	ans = max(temp , ans)
print(m - ans)

Solution (Python):
import sys

def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))

def main():
    s = IS()
    t = IS()
    len_s = len(s)
    len_t = len(t)
    minv = 10**5
    for i in range(0, len_s - len_t + 1):
        cnt = 0
        for j in range(len_t):
            if s[i+j] != t[j]:
                cnt += 1
        minv = min(minv, cnt)
    print(minv)


if __name__ == '__main__':
    main()

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

Solution (Python):


s=list(input())
t=list(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()
ms=1000
for i in range(len(s) - len(t) + 1):
    u = 0
    for j in range(len(t)):
        if t[j] != s[i+j]:
            u += 1
    if u < ms:
        ms = u

print(ms)

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]: continue
        else: tmp += 1
    ans = max(ans ,tmp)
print(len(T) - ans)

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

ans = 1001

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

print(ans)

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

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

mi = 10000

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

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


size = len(T)
ans = float("inf")
for i in range(len(S)-size+1):
    if S[i:i+size] == T:
        ans = 0
    else:
        cnt = 0
        sub_S = S[i:i+size]
        for t, s in zip(T, sub_S):
            if t != s:
                cnt += 1
        ans = min(ans, cnt)

print(ans)

Solution (Python):
s = input()
t = input()
res = len(t)
for i in range(0, len(s) - len(t) + 1):
    si = s[i:i + len(s)]
    tmp = len(t)
    for i in range(len(t)):
        if si[i] == t[i]:
            tmp -= 1
    res = min(res, tmp)

print(res)

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

lst = []

for i in range(len(s) - len(t) + 1):
    cnt = 0
    for j, tt in enumerate(t):
        if s[i+j] != t[j]:cnt += 1
    lst.append(cnt)
print(min(lst))

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

mx = -1
for i in range(len(S) - l + 1):
    m = [a == b for a, b in zip(S[i:i + l], T)].count(True)
    mx = max(m, mx)

print(l - mx)

Solution (Python):
s = input()
s=list(s)
t = input()
t=list(t)
k=len(t)
ans=k
for i in range(len(s)-k+1):
    su=0
    for j in range(k):

        if t[j]==s[i+j]:
            su+=1
        
    ans=min(ans,k-su)

print(ans)

Solution (Python):
s = input()
t = input()
p = len(t)
for i in range(len(s)-len(t)+1):
    q = 0
    for j in range(len(t)):
        if(s[i+j] != t[j]):
            q += 1
    p = min(p,q)
print(p)

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

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

Solution (Python):


import sys

DEBUG = False


def read(t):
    return t(sys.stdin.readline().rstrip())


def read_list(t, sep=" "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return


def main():
    s = read(str)
    t = read(str)

    min_mismatch = 10000
    for start in range(0, len(s) - len(t) + 1):
        mismatch = 0
        for i in range(start, start + len(t)):
            if s[i] != t[i - start]:
                mismatch += 1
        if mismatch < min_mismatch:
            min_mismatch = mismatch
    print(min_mismatch)


if __name__ == "__main__":
    main()

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

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

    ans = max(ans,count)
print(len(T)-ans)

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

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

minnum = 1000
i = 0
while i <= len(S)-len(T):
  num = 0
  j = 0
  
  while j < len(T):
    if S[i+j] != T[j]:
      num += 1
    j += 1
  
  if minnum > num:
    minnum = num
  i += 1

print(minnum)

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

ans_list=[]
for s in range(len(S)-len(T)+1):
    ans = 0
    for t in range(len(T)):
        if S[s+t] != T[t]:
            ans += 1
    ans_list.append(ans)
print(min(ans_list))

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

anses = []
for i in range(len(s) - len(t)+1):
  cnt = 0
  for c, d in zip(s[i:i + len(t)], t):
    if c != d:
      cnt += 1
  anses.append(cnt)

print(min(anses))

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

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

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

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

min_count = len(T)
for i in range(len(S) - len(T) + 1):
    count = 0
    for x in range(len(T)):
        if S[i+x] != T[x]:
            count += 1

    if count < min_count:
        min_count = count

print(min_count)

Solution (Python):
s = list(input())
t = list(input())
sa = float('inf')

for i in range(len(s)-len(t)+1):
    s_part = s[i:(i+len(t))]
    huitti = len(t)
    for j in range(len(t)):
        if s_part[j] == t[j]:
            huitti -= 1
    sa = min(sa, huitti)

print(sa)

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

ans = 10**9

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)

Solution (Python):
S = input()
T = input()
ans = 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 ans > a:
        ans = a
print(ans)

Solution (Python):
S = input()
T = input()
s_len = len(S)
t_len = len(T)
cnt = t_len
for idx in range(s_len - t_len + 1):
    
    tmp_cnt = 0
    for in_idx in range(t_len):
        if T[in_idx] != S[idx + in_idx]:
            tmp_cnt += 1
    if tmp_cnt < cnt:
        cnt = tmp_cnt
print(cnt)

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

Solution (Python):
s = list(input())
t = list(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
            
    ans = max(ans, cnt)

print(len(t) - ans)

Solution (Python):
s=input()
t=input()
u=m=len(t)
for i in range(len(s)-u+1):
	m=min(m,sum([1 for j in range(u) if s[i+j]!=t[j]]))
print(m)

Solution (Python):
s = input()
t = input()
ans = []
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.append(cnt)
    cnt = 0
print(min(ans))

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

min_c = len(S)

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

print(min_c)

Solution (Python):
def resolve():
    s=input()
    t=input()
    ans=0
    for i in range(len(s)-len(t)+1):
        ansh=0
        for j in range(len(t)):
            if s[i+j]==t[j]:
                ansh+=1
        ans=max(ansh,ans)
    print(len(t)-ans)
resolve()

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

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

chk = []
for i in range(lens-lent+1):
    chk_sum = 0
    tmp = s[i:i+lens]
    for j in range(lent):
        if tmp[j] == t[j]:
            chk_sum += 1
    chk.append(chk_sum)

print(lent - max(chk))

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()

def hantei(S,T):
    anss=0
    for i in range(len(S)):
        if S[i]!=T[i]:
            anss+=1
    return anss

def main():
    S=input()
    T=input()
    ans=10000
    for i in range(len(S)-len(T)+1):
        ans=min(ans,hantei(T,S[i:i+len(T)]))
    print(ans)



if __name__ == '__main__':
    main()

Solution (Python):
s = input()
t = input()
ans = 300000
for i in range(len(s)-len(t)+1):
    temp = 0
    for j in range(len(t)):
        if t[j] != s[i+j]:
            temp += 1
    ans = min(ans,temp)

print(ans)

for i in range(0):
    print(i)

Solution (Python):
from sys import stdin,stdout
s=input();n=len(s)
t=input();n1=len(t);ans=n1
for i in range(n-n1+1):
    s1=s[i:i+n1]
    changes=sum(1 for ch,ch1 in zip(t,s1) if ch!=ch1)
    ans=min(ans,changes)
print(ans)

Solution (Python):
from math import ceil
from collections import defaultdict, deque


def A(d, t, s):
  if t * s >= d:
    return 'Yes'
  return 'No'


def B(s, t):
  len_t = len(t)
  len_s = len(s)

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

  min_to_change = 1001
  for i in range(len_s - len_t + 1):
    to_change = _get_to_change(s[i:i + len_t], t)
    if to_change < min_to_change:
      min_to_change = to_change
  return min_to_change


def C(n, a):
  pass


def D(n):
  pass


def main():
  
  
  s = input()
  t = input()
  print(B(s, t))


if __name__ == '__main__':
  main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

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

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