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









MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def Main():
    s = list(read_str())
    t = list(read_str())
    ans = INF

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

if __name__ == '__main__':
    Main()

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

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

l_S = len(S)
l_T = len(T)
ans = l_T
for i in range(l_S - l_T + 1):
    S2 = S[i:i+l_T]
    ans = min(ans, check(S2, T, l_T))

print(ans)

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

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

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

    if ans == 10**4:
        print(len(T))
    else:
        print(ans)

if __name__ == "__main__":
    main()

Solution (Python):

import os
import sys
from io import BytesIO, IOBase


 
 
def main():

    s=input()
    t=input()
    n=len(s)
    m=len(t)
    ans=m
    for x in range(n-m+1):
        count=0
        cc=0
        for y in range(x,x+m):
            
            if s[y]!=t[cc]:
                count+=1
            cc+=1
        ans=min(count,ans)
    print(ans)





BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

Solution (Python):
mod = 10**9 + 7
def solve():
    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 t[j] != s[j + i]:
                tmp += 1
        ans = min(ans, tmp)
    print(ans)
t = 1
while t > 0:
    solve()
    t -= 1

Solution (Python):
S = input()
T = input()
mx = 0
for i in range(len(S) - len(T) + 1):
    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)

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

Solution (Python):
import sys
s = sys.stdin.readline().rstrip("\n")
t = sys.stdin.readline().rstrip("\n")
l = len(s)-len(t)+1
ans = 10000000000
for i in range(l):
    s_ = s[i:i+len(t)]
    ans_ = 0
    for j in range(len(t)):
        if t[j] != s_[j]:
            ans_ += 1
    ans = min(ans,ans_)
print(ans)

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

m = 0
for i in range(len(S)-len(T)+1):
  n = 0
  for j in range(len(T)):
    if(S[i+j]==T[j]):
      n+=1
  if(n>m):
    m = n
print(len(T)-m)

Solution (Python):

S = list(input())
T = list(input())
ans=10000000

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

print(ans)

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

Solution (Python):










import sys
def _p(*_a):
  
  _s=" ".join(map(str,_a))
  
  sys.stderr.write(_s+"\n")

def _pa(_aa):
  
  for _a in _aa: _p(_a)


S = input()
T = input()

ans = len(T)



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

print(ans)

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

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

ls = len(s)
lt = len(t)
n = ls - lt + 1
l = []

cnt = 0
for i in range(n):
    for j in range(lt):
        if t[j] != s[i + j]:
            cnt += 1
    l.append(cnt)
    cnt = 0
    
print(min(l))

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

ans = 10**10

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

Solution (Python):

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

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



if __name__ == '__main__':
    main()

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

ans=float("inf")
for i in range(len(S)):
    tmp=0
    for j in range(len(T)):
        if i+j>=len(S):
            break
        if S[i+j]==T[j]:
            continue
        else:
            tmp+=1
    else:
        ans=min(ans,tmp)
print(ans)

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

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import bisect
from functools import lru_cache
from collections import defaultdict
inf = float('inf')
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline().rstrip()
def read():
  return int(readline())
def reads():
  return map(int, readline().split())
s=input()
t=input()
max=10000
for i in range(len(s)-len(t)+1):
    num=0
    for j in range(len(t)):
        if(t[j]!=s[i+j]):
            num+=1  
    if num<max:
        max=num
print(max)

Solution (Python):
T=input()
S=input()
m = 10**10
lt=len(T)
ls=len(S)
for i in range(0,lt-ls+1):
  tmp=T[i:ls+i]
  mm=0
  for j in range(ls):
    if tmp[j]!=S[j]:
      mm+=1
  m = min(m, mm)
print(m)

Solution (Python):
def main():
    s = input()
    t = input()
    ld = len(s)-len(t)
    ans = 9999999999
    for i in range(ld+1):
        v = sum([0 if a==b else 1 for (a,b) in zip(list(s[i:]),list(t))])
        ans = min(ans, v)
    print(ans)

main()

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

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

print(len(T) - best_score)

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

l=len(s)
r=len(t)

ans=10000000

for i in range(l-r+1):
  ch=0
  for j in range(r):
    if s[i+j]==t[j]:
      ch+=1
  ans=min(ans,r-ch)
  
print(ans)

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

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

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


s = input()
t = input()
n = len(s)
m = len(t)
ans = float("inf")
for i in range(n):
    if i+m>n:
        break
    val = sum((c!=c2) for c,c2 in zip(s[i:i+m], t))
    ans = min(ans, val)

print(ans)

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

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

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

print(ans)

Solution (Python):
ans=float("INF")
s=list(input())
t=list(input())
s_len=len(s)
t_len=len(t)

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

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

ans = len(T)

def n_gram(target, n):
  
  return [ target[idx:idx + n] for idx in range(len(target) - n + 1)]

for s in n_gram(S,len(T)):
  mini = 0
  for s1,t1 in zip(s,T):
    if s1 != t1: mini+=1
  ans = min(ans,mini)
print(ans)

Solution (Python):


import sys
readline = sys.stdin.readline
read = sys.stdin.read


s = input()
t = input()

ans = 1000000

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

for i in range(ls-lt+1):
    ss = s[i:i+lt]
    
    r = sum(a!=b for a,b in zip(ss,t))
    
    ans = min(ans,r)

print(ans)

Solution (Python):

MOD = 10 ** 9 + 7
INFI = 10**10

import math
from collections import deque
import itertools
import heapq

from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint




def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default




def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def main():
    
    s=input()
    t=input()
    count=len(t)
    temp=0
    for i in range(len(s)-len(t)+1):
        temp=0
        for j in range(len(t)):
            a=s[i+j]
            b=t[j]
            if s[i+j]!=t[j]:
                temp+=1
        count=min(temp,count)
    print(count)



if __name__ == "__main__":

    main()

Solution (Python):
def compare(a, b):
    result = 0
    for i in range(len(a)):
        if a[i] != b[i]:
            result += 1
    return result

s = input()
t = input()

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

diff = []
for i in range(ls-lt+1):
    diff.append(compare(s[i:i+lt], t))
print(min(diff))

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

    ans = len(t)
    for i in range(len(s) - len(t) + 1):
        match_count = 0
        for ti, c in enumerate(t):
            if s[i + ti] == c:
                match_count += 1
                ans = min(len(t) - match_count, ans)

    print(ans)


if __name__ == '__main__':
    main()

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

s = 10**5
for i in range (len(S) - len(T) +1):
    wrong = 0
    for j in range (len(T)):
        if S[i+j] != T[j]:
            wrong+=1
    if wrong < s:
        s = wrong

print(s)

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

Solution (Python):

import sys
import numpy as np


def solve(S: str, T: str):
    ans = -1
    for i in range(len(S)-len(T)+1):
        sub = S[i:i+len(T)]
        m = 0
        for j in range(len(T)):
            if sub[j]==T[j]:
                m += 1
        ans = max(ans, m)
    print(len(T)-ans)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  
    T = next(tokens)  
    solve(S, T)

if __name__ == '__main__':
    main()

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

ans = 100000000
for i in range(len(S)-len(T)+1):
    ans = min(ans, sum(s != t for s, t in zip(T, S[i:i+len(T)])))
print(ans)

Solution (Python):
s_line = input()
s_list = list(s_line)

t_line = input()
t_list = list(t_line)

result = len(t_list)

for i in range(len(s_list) - len(t_list) + 1):
    temp = len(t_list)
    for j in range(len(t_list)):
        if(s_list[i+j] == t_list[j]):
            temp -= 1
            
    if(temp < result):
        result = temp
        
print(result)

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

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

  print(min_count)

if __name__ == "__main__":
  resolve()

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
    if tmp < ans:
        ans = tmp
print(ans)

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

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

ans = 9999
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 < ans:
    ans = tmp

print(ans)

Solution (Python):
S = input()
T = input()
ans = 10**6
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()

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

print(min([check(i,T) for i in range(len(S)-len(T)+1)]))

Solution (Python):






S = input()
T = input()





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

Solution (Python):

import os
from sys import stdin, stdout
    
    
def solve(tc):
    s = stdin.readline().strip()
    t = stdin.readline().strip()

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

    for i in range(1, 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)



    
tcs = 1
tc = 1
while tc <= tcs:
    solve(tc)
    tc += 1

Solution (Python):
import sys

s = input()
t = input()
difl = []

for i in range(len(s)-len(t)+1):
    if s[i:i+len(t)] == t:
        print(0)
        sys.exit()
    else:
        dif = 0
        for j in range(len(t)):
            if s[j+i] != t[j]:
                dif += 1
    difl.append(dif)

print(min(difl))

Solution (Python):
s = input()
t = input()
ans = 10**9 + 7
for i in range(len(s) - len(t) + 1):
    trystr = s[i:i+len(s)+1]
    tryans = 0
    for j in range(len(t)):
        if trystr[j] != t[j]:
            tryans += 1
    if tryans <= ans:
        ans = tryans
print(ans)

Solution (Python):
s=list(input())
t=list(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()
max = len(S)
for i in range(len(S)-len(T)+1):
    ans = len(T)
    for i,v in zip(T,S[i:i+len(T)]):
        if i == v:
            ans-=1
    if ans < max:
        max = ans
print(max)

Solution (Python):

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

Solution (Python):
def main():
    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 count <= ans:
            ans = count
    
    print(ans)
    
if __name__ == '__main__':
    main()

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

Solution (Python):
from sys import stdin
readline = stdin.buffer.readline
read = stdin.buffer.read





def main():
    S = readline().rstrip()  
    T = readline().rstrip()
    ls = len(S)
    lt = len(T)
    ans = lt
    for i in range(ls - lt + 1):
        cnt = lt
        for j in range(lt):
            if S[j + i] == T[j]:
                cnt -= 1
        ans = min(ans, cnt)
    print(ans)

if __name__ == "__main__":
    main()

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

minimum = len(T)
for i in range(len(S)):
    count = len(T)
    for j in range(len(T)):
        if i+j >= len(S):
            count = len(T)
            break
        if S[i+j] == T[j]:
            count -= 1
    minimum = min(minimum, count)

print(minimum)

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

if S in T:
    print('0')
else:
    count = 0
    for i in range(len(S) - len(T) + 1):
        tmp = 0
        for p in range(len(T)):
            if S[i + p] == T[p]:
                tmp += 1
        
        if count < tmp:
            count = tmp
    
    print(len(T) - count)

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

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

print(len(t)-count_max)

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

print(ans)

Solution (Python):
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)+1):
    temp = S[i:i+len(T)]
    diff_num = diff_count(T,temp)
    ans = min(diff_num,ans)
print(ans)

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

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

Solution (Python):

s = input()
v = input()
ans = 0
for i in range(len(s)-len(v)+1):
    count = 0
    for j in range(len(v)):
        if s[i+j] == v[j]:
            count += 1
    if count > ans:
        ans = count
print(len(v) - ans)

Solution (Python):
S=input()
T=input()
NS=len(S)
NT=len(T)
ans=pow(10,9)
for n in range(NS-NT):
    suuji=0
    for m in range(NT):
        if S[n+m]!=T[m]:
            suuji+=1
    ans=min(ans,suuji)
if NS==NT:
    suuji=0
    for n in range(NS):
        if S[n]!=T[n]:
            suuji+=1
    ans=min(suuji,ans)
print(ans)

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

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

Solution (Python):
import sys


def main():
    S = sys.stdin.readline().rstrip()
    T = sys.stdin.readline().rstrip()

    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)


main()

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

Solution (Python):
s = input()
t = input()
l0 = len(s)
l1 = len(t)
ans = 10**9
for i in range(l0 - l1 + 1):
  x = 0
  for j in range(l1):
    if s[i + j] != t[j]:
      x += 1
  ans = min(ans, x)
print(ans)

Solution (Python):
def abc177b():
    s = input()
    t = input()
    min_val = 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
        min_val = min(cnt, min_val)
    print(min_val)


abc177b()

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

ans = len(t)
for i in range(len(s) - len(t) + 1):
    cnt = sum(si != ti for si, ti in zip(s[i:i + len(t)], t))
    ans = min(cnt, ans)
print(ans)

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

Solution (Python):
def readinput():
    s=input()
    t=input()
    return s,t

def main(s,t):
    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
        ans=min(ans,count)
    return ans

if __name__=='__main__':
    s,t=readinput()
    ans=main(s,t)
    print(ans)

Solution (Python):
import sys


def main():
    S = input()
    T = input()
    N = len(S)
    M = len(T)
    ans = float('inf')
    for i in range(N - M + 1):
        cnt = 0
        for j in range(M):
            if T[j] != S[i:(i + M)][j]:
                cnt += 1
        ans = min(ans, cnt)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
s = input()
t = input()
ans = 1000
if len(s) == len(t):
  cnt = 0
  for j in range(len(t)):
    if s[j] != t[j]:
      cnt += 1
  ans = cnt
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)

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

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

imin=lent
for i in range(lens-lent+1):
    icnt=0
    for j in range(lent):
        if s[i+j]!=t[j]:
            icnt+=1
    imin=min(imin,icnt)   
print(imin)

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

ans = len(T)

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

    ans = min(ans, ans_offset)

print(ans)

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush

sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplt(n): return [tuple(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

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

print(ans)

Solution (Python):













from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce
import numpy as np
import random
import bisect
import copy
import time



MOD = int(1e9+7)
INF = float('inf')
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

def keta(kazu): 
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers): 
    return reduce(math.gcd, numbers)

def combination(m,n): 
    
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))

def pow_k(x,n):  
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2
    return K * x

def fact(n): 
    arr = {}
    temp = n
    for i in range(2,int(n**0.5)+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt
    if temp != 1:
        arr[temp] = 1
    if arr == {}:
        arr[n] = 1
    return arr
    
def main():
    S = stdin.readline().rstrip()
    T = stdin.readline().rstrip()
    now = 0
    ans = INF
    for i in range(len(S)-len(T)+1):
        S2 = S[i:i+len(T)]
        now = 0
        for j in range(len(T)):
            if T[j] != S2[j]:
                now += 1
        ans = min(now,ans)
    print(ans)
main()

Solution (Python):
s = input()
t = input()
if t in s:
  print("0")
else:
  mindif = 1000
  for i in range(len(s)-len(t)+1):
    ss = s[i:i+len(t)]
    difs = 0
    for j in range(len(t)):
      if ss[j] != t[j]:
        difs += 1
    mindif = min(mindif,difs)
  print(mindif)

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

diff_min = len(t)
while len(s) >= len(t):
    diff = 0
    for i in range(len(t)):
        if s[i] != t[i]:
            diff += 1
    diff_min = min(diff_min, diff)
    s = s[1:]
print(diff_min)

Solution (Python):
s=input()
t=input()
a=1000
for i in range(len(s)-len(t)+1):
    c=0
    for l in range(len(t)):
        if s[l+i]!=t[l]:
            c+=1
    if c<a:
        a=c
print(a)

Solution (Python):
s=input()
t=input()
m=float("infinity")
for i in range(len(s)):
	count=0
	if i+len(t)<=len(s):
		for j in range(len(t)):
			if t[j]!=s[i+j]:
				count+=1
		m=min(m,count)
if t in s:
	m=0
print(m)

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

min_diff = len(t)

for i in range(len(s) - len(t) + 1):
    sub_s = s[i:i+len(t)]
    num_diff = 0
    for i in range(len(t)):
        num_diff += 0 if sub_s[i] == t[i] else 1

    min_diff = min(min_diff, num_diff)
    
print(min_diff)

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

ans = 10000

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

print(ans)

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


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

Solution (Python):
from math import inf

S = input()
T = input()

best = inf
for i in range(len(S)):
    if i + len(T) <= len(S):
        diff = sum(1 for x, y in zip(S[i : i + len(T)], T) if x != y)
        best = min(diff, best)
print(best)