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
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import copy
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


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


def main():
    
    
    solve()


if __name__ == "__main__":
    main()

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    S = rl().rstrip()
    T = rl().rstrip()
    
    ans = 1001
    for i in range(len(S) - len(T) + 1):
        cnt = len(T)
        for j in range(len(T)):
            cnt -= S[i + j] == T[j]
        ans = min(ans, cnt)
    print(ans)


if __name__ == '__main__':
    solve()

Solution (Python):


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

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

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

sone = ''

small = 0

if slen != tlen:
    for i in range(slen-tlen):
        sone = s[i:i+tlen]
        count = 0
        for e in range(tlen):
            if sone[e] != t[e]:
                count = count + 1
        if i == 0:
            small = count
        else:
            if count <= small:
                small = count
else:
    sone = s
    count = 0
    for e in range(tlen):
        if sone[e] != t[e]:
            count = count + 1
    small = count

print(small)

Solution (Python):
S = input()
T = input()
match = 0
ans = 0
 
for n in range(len(S)-len(T)+1):
  match2 = 0
  U = S[n:n+len(T)]
  for m in range(len(T)):
    if U[m]==T[m]:
      match2+=1
  match = max(match,match2)
      
print(len(T)-match)

Solution (Python):
from typing import List
import sys


def solution(inp: List) -> int:
    S = inp[0]
    T = inp[1]
    ans = len(T)

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


inp: List = []
for j in sys.stdin:
    inp += j.split()
print(solution(inp))

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

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

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

d = 10000
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
    d = min(c,d)
print(d)

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

d = 10000
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
    d = min(c,d)
print(d)

Solution (Python):
from functools import reduce
s, t = input(), input()
ans = 10**9
for i in range(0, len(s) - len(t)+1):
    ans = min(ans, reduce(lambda x, a: x + (1 if a[0] != a[1] else 0), zip(s[i:], t), 0))
print(ans)

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

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

l=[]
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
        else:
            pass
    l.append(cnt)
print(len(t)-max(l))

Solution (Python):

import sys

S =input().strip()
T =input().strip()
match =[]

for s_start in range(len(S)):
    S2 =S[s_start:]
    a=0
    if len(S2) < len(T):
        break
    for t in range(len(T)):
        if S2[t] ==T[t]:
            a +=1
    match.append(a)
ans =len(T) -max(match)
print(ans)

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

for n in range(len(S)-len(T)+1):
  match2 = 0
  U = S[n:n+len(T)]
  for m in range(len(T)):
    if U[m]==T[m]:
      match2+=1
  match = max(match,match2)
      
print(len(T)-match)

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

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

Solution (Python):
s = input()
t = input()
minCount = len(t)
i = 0
while i < len(s) and i + len(t) <= len(s):
    countSame = 0
    j = 0
    while j < len(t):
        if t[j] == s[i+j]:
            countSame += 1
        j += 1
        minCount = min(len(t) - countSame, minCount)
    i += 1
print(minCount)

Solution (Python):
def main():
  s=input()
  t=input()
  ls=len(s)
  lt=len(t)
  r=0
  if ls==lt:
    for i in range(ls):
      if s[i]==t[i]:
        r+=1
    print(lt-r)
    exit()
  st= [ [ 0 for y in range(ls ) ] for x in range( lt ) ]
  for si in range(ls):
    for ti in range(lt):
      if s[si]==t[ti]:
        st[ti][si]=1
  r=0
  for si in range(ls-lt):
    rt=0
    for ti in range(lt):
      rt+=st[ti][(si+ti)]
    if r<rt:
      r=rt
  print(lt-r)
main()

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):
import sys
def minimumChar(T,S): 
    n, m = len(T), len(S) 
    ans = sys.maxsize 
    for i in range(m - n + 1): 
        minRemovedChar = 0
        for j in range(n): 
            if (T[j] != S[i + j]): 
                minRemovedChar += 1
        ans = min(minRemovedChar, ans) 
    return ans 
      
S=input()
T=input()

print(minimumChar(T,S))

Solution (Python):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    s = input()
    t = input()
    if t in s:
        print(0)
        sys.exit()
    if len(s) == 1 and len(t) == 1:
        if t != s:
            print(1)
            sys.exit()
    lens = len(s)
    lent = len(t)
    res = set()
    for i1 in range(lens - lent + 1):
        tmp1 = sum([c1 == c2 for c1, c2 in zip(t, s[i1:i1+lent])])
        res.add(lent - tmp1)
        
    if res:
        r = min(res)
        print(r)
    else:
        print(lent)

if __name__ == '__main__':
    main()

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

Solution (Python):
S = input()
T = input()
N = len(S)
n = len(T)
ans = N
for i in range(N-n+1):
    s = S[i:i+n]
    temp = 0
    for ss, t in zip(s, T):
        temp += ss != t
    ans = min(ans, temp)

print(ans)

Solution (Python):
def minChange(S, T):
    m, n = len(S), len(T)
    
    min_change = n
    
    
    for i in range(0, m - n + 1):
        total_diff = 0
        
        for j in range(0, n):
            
            if T[j] != S[i+j]:
                total_diff += 1
        
        min_change = min(min_change, total_diff)
    
    return min_change    

S = str(input())
T = str(input())
print(minChange(S, T))

Solution (Python):
S = input()
T = input()
 
ans = len(T)
  
for i in range(len(S)-len(T)+1):
  sub =0
  for j in range(len(T)):
    if not S[i+j] == T[j]:
      sub += 1
  ans = min(sub,ans)
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):


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

    res = len(t)
    
    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
        res = min(res, diff)
    print(res)
if __name__ == '__main__':
    main()

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

min_count = len(T)
for s in range(len(S) - len(T) + 1):  
    matched = 0
    for i in range(len(T)):
        
        if S[s + i] == T[i]:
            matched += 1
    count = len(T) - matched
    if count < min_count:
        min_count = count
print(min_count)

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

N = len(T)

s_list = []
for i in range(len(S) - N + 1):
    s = S[i:i + N]
    s_list.append(s)
    
answer = N
for s in s_list:
    counter = 0
    for i in range(N):
        if s[i] != T[i]:
            counter += 1
    answer = min(answer, counter)

print(answer)

Solution (Python):
s=list(input())
t=list(input())
n=len(t)
val=0
for i in range(len(s)-n+1):
    temp=0
    for j in range(n):
        if s[i+j]==t[j]:
            temp+=1
    val=max(val,temp)
    if val==n:
        break
print(n-val)

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 cnt > ans:
        ans = cnt
print(len(T)-ans)

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

cnt = []
for i in range(len(s) - len(t) + 1):
    cnt1 = 0
    for k in range(len(t)):
        if t[k] == s[i: i + len(t)][k]:
            cnt1 += 1
            cnt.append(cnt1)
            
        else:
            cnt.append(0)
            

print(len(t) - max(cnt))

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

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

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

Solution (Python):


S = input()
T = input()

a = 0
ans = len(T)

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

print(ans)

Solution (Python):
INF = 10 ** 19
s = list(input())
t = list(input())
N = len(s)
M = len(t)

def check(s,t):
    res = 0
    for i in range(M):
        if s[i] != t[i]:
            res += 1
    return res

ans = INF
for i in range(N-M+1):
    ans = min(ans, check(s[i:i+M], t))
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
  ans = max(cnt, ans)
  
print(len(t)-ans)

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

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

S_list = list(S)
T_list = list(T)

con = 0
for i in range(len(S_list)-len(T_list) + 1):
  count = 0
  for j in range(len(T_list)):
    if S_list[i + j] == T_list[j]:
      count +=1
  if count > con:
    con = count

ans = len(T_list) - con
print(ans)

Solution (Python):
S =input()
T = input()
a = len(S)
x = len(T)
ans = 0
sum_l = []
if a == x:
  for i in range(a):
    if S[i] != T[i]:
      ans += 1
  print(ans)
else:
  for i in range(a-x+1):
    for j in range(x):
      if S[i+j] != T[j]:
        ans += 1
    sum_l.append(ans)
    ans = 0
  print(min(sum_l))

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

cnt = []
for i in range(len(s) - len(t) + 1):
    cnt1 = 0
    for k in range(len(t)):
        if t[k] == s[i: i + len(t)][k]:
            cnt1 += 1
            cnt.append(cnt1)
            
    else:
        cnt.append(0)
            

print(len(t) - max(cnt))

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


if __name__ == '__main__':
    main()

Solution (Python):
S,T=open(0).read().split()
score = 0
for i in range(len(S)-len(T)+1):
    score=max(score,sum([T[k]==S[i+k] for k in range(len(T))]))
print(len(T)-score)

Solution (Python):
S=input()
T=input()
N=len(S)
ans=10**30
for i in range(N-len(T)+1):
    cnt=0
    for j in range(len(T)):
        if S[j+i]!=T[j]:
            cnt+=1
    ans=min(ans,cnt)
print(ans)

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

count = len(t)

for i in range(len(s) - len(t) + 1):
    str_ = s[i:i + len(t)]
    temp = 0
    for i in range(len(str_)):
        
        if str_[i] != t[i]:
            temp += 1
    count = min(count, temp)    
        
print(count)

Solution (Python):
import sys
s = list(input())
t = list(input())
ans = float('inf')

for i in range(len(s)):
    count = 0
    for j in range(len(t)):
        if i + j >= len(s):
            print(ans)
            sys.exit()

        if s[i+j] != t[j]:
            count += 1
    ans = min(ans, count)

print(ans)

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

print(ans)

Solution (Python):
a = input()
b = input()
c = int(len(a))
d = int(len(b))
e = c-d+1
ans = int(0)
temp = int(0)
for i in range(e):
  temp = 0
  for j in range(d):
    if a[j+i] == b[j]:
      temp += 1
  if ans < temp:
    ans = temp

print(d-ans)

Solution (Python):
def main():
    s = input()
    t = input()
    len_s = len(s)
    len_t = len(t)
    ans = 10 ** 12

    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()
ls=len(s)
lt=len(t)
ans=10000000
for i in range(ls-lt+1):
    temp=s[i:i+lt]
    cnt=0
    for j in range(lt):
        if temp[j]!=t[j]:
            cnt+=1
    ans=min(ans,cnt)
print(ans)

Solution (Python):
s = input()
t = input()
n, m = len(s), len(t)
print(min(sum(si != ti for si, ti in zip(s[i: i+m], t)) for i in range(n-m+1)))

Solution (Python):
S = input()
T = input()
MIS = len(S)
for TS in range(0,len(S)-len(T)+1):
    LS = S[TS:TS+len(T)]
    Count = sum(True if LS[TT]!=T[TT] else False for TT in range(0,len(T)))
    MIS = min(MIS,Count)
print(MIS)

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

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

Solution (Python):


def get_input() -> tuple:
    """
    標準入力を取得する.

    Returns:\n
        tuple: 標準入力
    """
    S = input()
    T = input()

    return S, T


def main(S: str, T: str) -> None:
    """
    メイン処理.

    Args:\n
        S (str): 文字列(1 <= |S| <= 1000)
        T (str): 文字列(1 <= |T| <= |S|)
    """
    
    ans = len(T)
    for i in range(len(S) - len(T) + 1):
        diff = 0
        for j in range(len(T)):
            if T[j] != S[i + j]:
                diff += 1
        ans = min(ans, diff)

    
    print(ans)


if __name__ == "__main__":
    
    S, T = get_input()

    
    main(S, T)

Solution (Python):
S, T = input(), input();print(min([sum([0 if x == y else 1 for x, y in zip(S[i:], T)]) for i in range(len(S) - len(T) + 1)]))

Solution (Python):
s = input()
t = input()
a = set()
for i in range(len(s) - len(t) + 1):
  u = s[i: i + len(t)]
  k = len(t)
  for j in range(len(t)):
    if u[j] == t[j]:
      k -= 1
  a.add(k)
ans = min(list(a))
print(ans)

Solution (Python):


import sys


S = input()
T = input()


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


print(ans)

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

Solution (Python):
x = [input() for i in range(2)]
S = x[0]
T = x[1]
moji = len(T)

for a in range(len(S) - len(T) + 1):
  count = 0
  for b in range(len(T)):
    
    if S[a+b] != T[b]:
      count += 1
  if count < moji:
    moji = count

print(moji)

Solution (Python):
S=list(input())
T=list(input())
x=[1000]*(len(S)+1)
for i in range(len(S)-len(T)+1):
    p=0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            p+=1
    x[i]=p
print(min(x))

Solution (Python):
S, T = input(), input()
print(min([sum([0 if x == y else 1 for x, y in zip(S[i:i + len(T)], T)]) for i in range(len(S) - len(T) + 1)]))

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

Solution (Python):


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

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

Solution (Python):
from sys import stdin
rs = lambda : stdin.readline().strip()
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))


def main():
    S = rs()
    T = rs()
    ls = len(S)
    lt = len(T)
    print(min([sum([0 if x == y else 1 for x, y in zip(S[i:i + lt], T)]) for i in range(ls - lt + 1)]))

if __name__ == '__main__':
    main()

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

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

ans = nt

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

Solution (Python):
S = list(input())
T = list(input())
ans = len(T)
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
    ans = min(ans, cnt)

print(ans)

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

ans = len(s)

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

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

ma=0
mamax=0

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

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

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

print(ans)

Solution (Python):
import difflib

S = input()
T = input()

A = len(S)
B = len(T)

moji = []

for i in range(A-B+1):
  moji.append(S[i:i+B])
  

cnt = 0
cnt_list = []
for i in range(len(moji)):
  for j in range(B):
    if moji[i][j] != T[j]:
      cnt += 1
  cnt_list.append(cnt)
  cnt = 0
  
print(min(cnt_list))

Solution (Python):
import sys
import math
S = str(input())
T = str(input())
 
 
d = 0
for i,o in enumerate(S):
        j = 0
        c = 0
        for l in S[i:i+len(T)]:
            if l == T[j]:
                c += 1
            j += 1
        d = max(d, c)
        if i > len(S) - len(T) - 1:
            break
print(len(T)-d)

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

ans = 10000
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
  ans = min(ans, score)
  
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 S[i+j] != T[j]:
            cnt += 1
    ans = min(ans,cnt)
print(ans)

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

min_cnt = 1005
len_t = len(t)
length = len(s)
for i in range(length-len_t+1):
  cnt = 0
  for j in range(len_t):
    if t[j] != s[i+j]:
      cnt += 1
  min_cnt = min(cnt, min_cnt)
    
print(min_cnt)

Solution (Python):
def resolve():
    s = input()
    t = input()
    ans = 10**4

    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(ch, ans)
    print(ans)

resolve()

Solution (Python):
s = input()
t = input()
count = 0
def ans(s, t):
    max = pow(10,9)
    if len(s)==len(t):
        max = 0
        for i in range(len(s)):
            if s[i]!=t[i]:
                max+=1
        return max
    else:
        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 max > count:
                max = count
        return max
print(ans(s,t))

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

if len(S) == 1:
    if S == T:
        print(0)
    else:
        print(1)

else:
    l = []
    for i in range(len(S) - len(T) + 1):
        A = S[i:i + (len(T))]
        
        count = 0
        for j in range(len(A)):
            if A[j] == T[j]:
                count += 1
                
        l.append(count)

    
    if len(l) > 0:
        a = len(T) - max(l)
        print(a)
    else:
        a = 1
        print(a)

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

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

    candidates = []
    for i in range(len(s)-len(t)+1):
        candidates.append(hamming(t,s[i:i+len(t)]))

    print(min(candidates))
if __name__ == "__main__":
    main()

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

Solution (Python):
def solve():
    Ss = input().rstrip()
    Ts = input().rstrip()

    lenS, lenT = len(Ss), len(Ts)

    ans = lenS
    for i in range(lenS-lenT+1):

        num = sum([S != T for S, T in zip(Ss[i:i+lenT], Ts)])
        if num < ans:
            ans = num

    print(ans)


solve()

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

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

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

res = 10000000000

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

if(res==10000000000):
    print(len(t))
else: 
    print(res)

Solution (Python):


s = list(input())
t = list(input())

ans = len(t)

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

print(ans)

Solution (Python):
import base64
import subprocess


exe_bin = "e??420s

exe_bin = base64.b85decode(exe_bin)

with open("./kyomu", 'wb') as f:
    f.write(exe_bin)

subprocess.run(["chmod +x ./kyomu"], shell=True)
subprocess.run(["./kyomu"], shell=True)

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

Solution (Python):
try:
    s=input()
    t=input()
    ls=len(s)
    lt=len(t)
    ans=float('inf')
    for i in range(ls-lt+1):
        s2=s[i:i+lt]
        m=0
        
        for j in range(lt):
            if s2[j]!=t[j]:
                m+=1
        ans=min(ans,m)
    print(ans)
except EOFError as e:
    print(e)

Solution (Python):
s = input()
t = input()
ans = 10**9
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):
import sys                                                                                                                               
                                                                                                                                         
S = input()                                                                                                                              
T = input()                                                                                                                              
                                                                                                                                         


                                                                                                                                         
flag = 0                                                                                                                                 
count = 0                                                                                                                                
                                                                                                                                         

s_len = len(S)                                                                                                                           
t_len = len(T)                                                                                                                           
                                                                                                                                         
start = 0                                                                                                                                
min = t_len                                                                                                                              
                                                                                                                                         
for start in range(0, s_len - t_len + 1):                                                                                                
    diff = 0                                                                                                                             
    for i in range(0, t_len):                                                                                                            
        if T[i] != S[start + i]:                                                                                                         
            diff = diff + 1                                                                                                              
                                                                                                                                         
    if min > diff:                                                                                                                       
        min = diff                                                                                                                       
                                                                                                                                         
                                                                                                                                         
print(min)

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

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

rec = len(T)
for i in range(len(S)-len(T)+1):
    subst = S[i:i+len(T)]

    rec = min(rec, len(T) - matchcount(subst, T))

print(rec)

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

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

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

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

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

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

    st = set()
    for i in range(len(S)-len(T)+1):
        cnt = 0
        for s, t in zip(S[i:i+len(T)], T):
            cnt += s == t
        st.add(cnt)
    print(len(T) - max(st))


if __name__ == '__main__':
    main()

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

print(ans)