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

Solution (Python):
s=list(input())
t=list(input())
r=tn=len(t)
for u in (s[i:i+tn] for i in range(len(s)-tn+1)):
	k=0
	for i,j in zip(u,t):
		k+=(i!=j)
	r=min(r,k)
print(r)

Solution (Python):

S = input()
T = 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
        else:
            pass
    if ans >= count:
        ans = count
    else:
        pass
print(ans)

Solution (Python):
S=input()
T=input()
a=len(S)
b=len(T)
m=a-b
ans=b
if m!=0:
    for i in range(m):
        cnt=b
        for j in range(b):
            if S[i+j]==T[j]:
                cnt-=1
        ans=min(cnt,ans)
else:
    cnt=b
    for i in range(a):
        if S[i]==T[i]:
            cnt-=1
    ans=min(cnt,ans)
print(ans)

Solution (Python):
from sys import stdin, stdout
from collections import Counter,deque
import math
cin = stdin.readline
cout = stdout.write
def inpn():
    return(int(cin()))
def inpl():
    return(list(map(int,cin().split())))
def inps():
    return cin()[:-1]
def inpv():
    return (map(int, cin().split()))
def outs(s):
    cout(s)
def outn(n):
    cout(str(n))
def outl(l):
    for i in l:
        cout(str(i)+" ")
def outb(s):
    cout(str(s))













s=inps()
t=inps()
ans=1000
if t in s:
    outn(0)
    cout("\n")
else:
    if len(s)!=len(t):
        for i in range(len(s)-len(t)):
            count=0
            for j in range(len(t)):
                if s[i+j]!=t[j]:
                    count+=1
            ans=min(ans, count)
        outn(ans)
        cout("\n")
    else:
        ans=0
        for i in range(len(s)):
            if s[i]!=t[i]:
                ans+=1
        outn(ans)
        cout("\n")

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
S,T = [S() for _ in range(2)]
num = 0
for i in range(len(S)-len(T)+1):
    str = S[i:i+len(T)]
    count = 0
    for j in range(len(T)):
        if str[j]==T[j]:
            count += 1
        num = max(num,count)
print(len(T)-num)

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

Solution (Python):
S = input()
T = input()
Ans = len(T)
for i in range(len(S)-len(T)+1):
    d = 0
    for j in range(len(T)):
        if T[j] != S[i:i+len(T)][j]:
            d += 1
    if d <= Ans:
        Ans = d

print(Ans)

Solution (Python):
S = input()
T = input()
d = len(S) - len(T)
print(len(T) - max(sum(t == s for t, s in zip(T, S[i : i + len(T) + 1])) for i in range(d + 1)))

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

print(ans)

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

maxtmp = 0
if len(S) == 1:
    if T in S:
        print(0)
    else:
        print(1)
else:
    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 maxtmp < tmp:
            maxtmp = tmp
    print(len(T) - maxtmp)

Solution (Python):
s = input()
t = input()
minr = len(t)
s_t_d = len(s) - len(t)
for i in range(s_t_d + 1):
    cnt = 0
    for ss, ts in zip(s[i:i + len(t)], t):
        if ss != ts:
            cnt += 1
    minr = min(minr, cnt)
print(minr)

Solution (Python):
S = str(input())
T = str(input())
Snagasa = len(S)
Tnagasa = len(T)
saisyuicchi = 0
for i in range (Snagasa-Tnagasa+1):
 icchi = 0
 for j in range (Tnagasa):
  if S[i+j] == T[j]:
   icchi = icchi + 1
  else:
   icchi = icchi
 if icchi > saisyuicchi:
  saisyuicchi = icchi
ans = Tnagasa - saisyuicchi
print (ans)

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

Solution (Python):

import math
from operator import mul
from functools import reduce
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
import copy
sys.setrecursionlimit(10**6)




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


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


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

min_ = 0
max_ = len(T)

for x in range(max_+1):
    
    for i in range(len(S) - len(T) + 1):
        count = 0
        for (a, b) in zip(T, S[i:i + len(T)]):
            if (a == b):
                count += 1
        if (count+x >= len(T)):
            print(x)
            exit()

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

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

len_S = len(S)
len_T = len(T)

min_count = float('inf')
for i in range(len_S - len_T + 1):
    
    match = 0
    for j in range(len_T):

        if T[j] == S[i + j]:
            match += 1
    min_count = min(len_T-match, min_count)
print(min_count)

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

r=len(t)
for ii in range(len(s)-len(t)+1):
  rr=0
  for jj in range(len(t)):
    if s[ii+jj]!=t[jj]:
      rr+=1
  if rr<r:
    r=rr
print(r)

Solution (Python):
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

s = inp()
t = inp()

total = 10**9

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

print(total)

Solution (Python):
S = input()
T = input()
count = 0
if T in S:
    print(0)
else:
    
    for i in range(len(S)-len(T)+1):
        check = S[i:len(T)+i-1]
        point = 0
        for w1, w2 in zip(T, check):
            if w1 == w2:
                point += 1
        if point > count:
            count = point
    print(len(T)-count)

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

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

con = lent;

for x in range(lens - lent + 1):
    zz = 0;
    for y in range(lent):
        if s[x+y] != t[y]:
            zz += 1;
    if zz < con:
        con = zz;

print(con)

Solution (Python):
S = input()
T = input()
m = 0
lt = len(T)
for i in range(len(S)- lt+1):
    pm = 0
    ps = S[i:lt+i]
    for j in range(lt):
          if ps[j] == T[j]:
               pm += 1
    m = max(m,pm)
              
print(len(T)-m)

Solution (Python):
S=input()
T=input()
count=0
min=1000000
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
    else:
        break

    if count<min:
        min=count

print(min)

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

ls = len(S)
lt = len(T)


ans = 1e10

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

print(ans)

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

maxt = len(t)

for i in range(0,len(s) - len(t) +1):
    s_part = s[i:i+len(t)+1]
    n=0
    for tt,ss in zip(t,s_part):
        if tt==ss:
            n+=1
    maxt =min(maxt,len(t)-n)
print(maxt)

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

Solution (Python):
S = input()
T = input()
len_S = len(S) - len(T)

ans = 0

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

print(len(T)-ans)

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

ans = len(T)
f = 0
for i in range(len(S)-len(T)+1):
  st = S[f:f+len(T)]
  iti = sum([1 for i,j in zip(st, T) if i == j])
  ans = min(ans, len(T)-iti)
  f += 1
  
print(ans)

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


def count_diff_chars(s, t):
    """
    文字列s, tの差分がある文字列数を数える
    """
    count = 0
    for i in range(len(s)):
        if s[i] != t[i]:
            count += 1
    return count


def count_diff_chars_t(s): return count_diff_chars(s, T)


len_s = len(S)
len_t = len(T)


if len_s == len_t:
    print(count_diff_chars_t(S))
else:
    now_min_diff = 1001

    for i in range(len_s - len_t):
        s_ = S[i: len_t + i]
        diff_num = count_diff_chars_t(s_)
        now_min_diff = min(diff_num, now_min_diff)

    print(now_min_diff)

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, permutations, combinations, accumulate
from bisect import bisect_left, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor


def input_list():
    return list(map(int, input().split()))


def input_int():
    return int(input())


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

Solution (Python):
S = input()
T = input()
answer = 0
for i in range(len(S)-len(T)+1):
    samecnt = 0
    for j in range(len(T)):
        if S[j+i] == T[j]:
            samecnt += 1
    answer = max(answer, samecnt)

print(len(T)-answer)

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

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

for j in range(lenS - lenT + 1):
  sameCnt = 0
  for i in range(lenT):
    if S[j + i] == T[i]:
      sameCnt += 1
  if chgCnt < sameCnt:
    chgCnt = sameCnt
    
print(lenT - chgCnt)

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

s_l = len(s)
t_l = len(t)

max_count = 0
for i in range(0, s_l - t_l + 1):
  count = 0
  for j in range(0, t_l):
    if s[i+j] == t[j]:
      count += 1
  if count > max_count:
    max_count = count

diff = t_l - max_count
print(diff)

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

minc = 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
    minc = min(minc, c)

print(minc)

Solution (Python):
S = input()
T = input()
ans = 0
if T in S:
    print(ans)
else:
    s = list(S)
    t = list(T)
    ans = 10000
    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 = list(input())
t = list(input())

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


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

print(ans)

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

answer = 10**3

for s in range(len(S)):
  if s + len(T) <= len(S):
    count = 0
    for t in range(len(T)):
      if S[s+t] != T[t]:
        count += 1
    answer = min(answer, count)
print(answer)

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

def func():
    z=0
    for i in range(0,len(S)-len(T)+1):
        p=0
        for j in range(0,len(T)):
            if T[j]==S[i+j]:
                p+=1
        if z<p:
            z=p
    return(len(T)-z)

print(func())

Solution (Python):

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

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

Solution (Python):
def main():
  S = input("")
  T = input("")
  
  length = len(T)
  S_sub_T = len(S) - length

  max_match = 0
  S_offset = 0
  for i in range(S_sub_T+1):
    match = 0
    for j in range(length):
      if(S[i + j] == T[j]):
        match += 1
    if(max_match < match):
      max_match = match
  
  need_replace = length - max_match
  print(need_replace)
 
if __name__ == "__main__":
  main()

Solution (Python):
S = input()
T = input()
list_s = list(S)
list_t = list(T)
A = []
for i in range(len(list_s)-len(list_t)+1):
    t = i
    count = 0
    for j in range(len(list_t)):
        if list_t[j] == list_s[t]:
            t +=1
            count +=1
        else:
            t +=1
    A.append(count)
print(len(list_t) - max(A))

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

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

now = 0
fg=0

for i in range(slen):
    count=0
    for j in range (tlen):
        if i + j > slen-1:
            fg = 1
            continue
        if (s[i+j]) == t[j]:
            count+=1
    if fg == 1:
        break
    if now < count:
        now = count

print(tlen-now)

Solution (Python):
def hamming2(s1, s2):
       """Calculate the Hamming distance between two bit strings"""
       assert len(s1) == len(s2)
       return sum(c1 != c2 for c1, c2 in zip(s1, s2))

   
S = input()
T = input()

len_t = len(T)

min_d = 10000
for i in range(len(S)-len_t+1):
    s = S[i:i+len_t]
    d = hamming2(s, T)
    if d < min_d:
        min_d = d

print(min_d)

Solution (Python):
x=input()
y=input()
dist=len(x)
for a in range(len(x)-len(y)+1):
  tmp=0
  for b in range(len(y)):
    if x[b+a]!=y[b]:
      tmp+=1
  if dist>tmp:
    dist=tmp
print(dist)

Solution (Python):
from sys import stdin

S = list(stdin.readline().rstrip())
T = list(stdin.readline().rstrip())

result_array = []
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
    result_array.append(len(T)-count)


print(min(result_array))

Solution (Python):
def minimumChar(S1, S2): 
    n, m = len(S1), len(S2) 
    ans = len(t) 
    for i in range(m - n + 1): 
        minRemovedChar = 0
        for j in range(n): 
            if (S1[j] != S2[i + j]): 
                minRemovedChar += 1
        ans = min(minRemovedChar, ans) 
    return ans 
s = list(input())
t = list(input())
print(minimumChar(t,s))

Solution (Python):
import sys
import math

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

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

print(ans)

Solution (Python):
import numpy as np
s = np.array(list(input()))
t = np.array(list(input()))
s_sub = np.array(list((s[i:i+len(t)] for i in range(len(s)-len(t)+1))))
ans = [0]*len(s_sub)
for i in range(len(s_sub)):
    ans[i] = np.count_nonzero(s_sub[i] == t)
print(len(t)-max(ans))

Solution (Python):
import sys


s = input()
s_len = len(s)


t = input()
t_len = len(t)

results = []

for start in range(0, s_len - t_len + 1):
    cut = s[start:start + t_len]
    diff_count = 0
    for i in range(0, t_len):
        if cut[i] != t[i]:
            diff_count += 1
    results.append(diff_count)

print(min(results))

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

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

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

    print(min_change)


if __name__ == '__main__':
    main()

Solution (Python):
from sys import stdin

S = stdin.readline().rstrip().split()[0]
T = stdin.readline().rstrip().split()[0]

count = 0
maxc = 0
for i in range(len(S) - len(T) + 1):
    for j,t in enumerate(T):
        if t == S[i + j]:
            count += 1
    if count >= maxc:
        maxc = count
    count = 0
print(len(T) - maxc)

Solution (Python):


import sys
from typing import Any, Callable, Deque, Dict, List, Mapping, Optional, Sequence, Set, Tuple, TypeVar, Union































def main():
    Num = Union[int, float]
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input():  return sys.stdin.readline().rstrip()
    def ii():     return int(input())
    def isp():    return input().split()
    def mi():     return map(int, input().split())
    def mi_0():   return map(lambda x: int(x)-1, input().split())
    def lmi():    return list(map(int, input().split()))
    def lmi_0():  return list(map(lambda x: int(x)-1, input().split()))
    def li():     return list(input())
    def debug(x): print(x, file=sys.stderr)
    
    
    
    s = input()
    t = input()
    n = len(s)
    m = len(t)
    ans = inf
    for i in range(n - m + 1):
        
        tmp = m
        for j in range(m):
            if t[j] == s[i + j]:
                tmp -= 1
        ans = min(tmp, ans)
    print(ans)



if __name__ == "__main__":
    main()

Solution (Python):

long=input()
 

short=input()
 
maximum_same=0
for i in range(len(long)-len(short)+1):
  newLong=long[i:i+len(short)]
  
  
  same=0
  for j in range(len(short)):
    if newLong[j]==short[j]:
      same+=1
  if same>maximum_same:
    maximum_same=same
 
print(len(short)-maximum_same)

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

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

ans=0

mylist=[]

for i in range(s-t+1):
    for j in range(t):
        if S[i:i+t][j]==T[j]:
            ans=ans+1
    mylist.append(ans)
    ans=0
print(t-max(mylist))

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

S= list(input().rstrip('\n'))
T= list(input().rstrip('\n'))
result = []
for i in range(len(S)-len(T)+1):
  s = S[i:len(T)+i]
  c = [1 for x in range(len(T)) if s[x]!=T[x]]
  result.append(sum(c))
print(min(result))

Solution (Python):


s = input()
t = input()

def distance(s, t):
    assert(len(s) == len(t))
    return len(s) - sum([c1 == c2 for c1, c2 in zip(s, t)])


min_d = len(s)

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

print(min_d)

Solution (Python):
s=str(input())
t=str(input())
list1=[]
c=0

for i in range(len(s)-len(t)+1):
  s2=s[i:i+len(t)]
  for i in range(len(t)):
    if t[i]==s2[i]:
      c +=1
  list1.append(c)
  c=0
print(len(t)-max(list1))

Solution (Python):


def comp_word(w1, w2, len):
    cnt = len
    for i,w in enumerate(w1):
        if w == w2[i]:
            cnt -= 1
    
    return cnt


def main(S, T):
    T_len = len(T)
    cnt_min = T_len
    for i in range(len(S)-T_len+1):
        sub_S = S[i:i+T_len]
        if len(sub_S) == T_len:
            cnt = comp_word(sub_S, T, T_len)
            if cnt < cnt_min:
                cnt_min = cnt 

    print(cnt_min)


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

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

cnt = len(S)-len(T)+1
man = 0

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

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

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

Solution (Python):
s = input()
t = input()
m = len(t)
for i in range(len(s) - len(t) + 1):
    x = s[i:i+len(t)]
    count = 0
    for a, b in zip(list(t), list(x)):
        if a != b:
            count += 1
    if m > count:
        m = count
print(m)

Solution (Python):
def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]
ans = 0

s = input()
t = input()
l = len(t)
if l == 1:
    if t in s: ans = 0
    else: ans = 1
else:
    mx = 0
    for idx, _ in enumerate(s[:-(l-1)]):
        word = ''
        for i in range(l):
            word += s[idx+i]
        x = 0
        for a, b in zip(word, t):
            if a == b: x += 1
        if x > mx: mx = x

    ans = l - mx

print(ans)

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

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

print(len(T) - ans)

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

Slen = len(S)
Tlen = len(T)
diff = Slen - Tlen

maxRes = 0

if diff == 0:
  for j in range(Tlen):
    if S[j] == T[j]:
      maxRes += 1
else: 
  for i in range(diff):
    res = 0
    for j in range(Tlen):
      if S[i + j] == T[j]:
        res += 1
    maxRes = max(maxRes, res)

ans = Tlen - maxRes

print(ans)

Solution (Python):
'''
Contest 177 - Task B


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

if __name__ == "__main__":
    haystack = input()
    needle = input()

    dists = []
    for i in range(len(haystack) - len(needle) + 1):
        sub = haystack[i : i+len(needle)]
        dists.append(count_changed_chars(sub, needle))
    print(min(dists))

Solution (Python):
import bisect
import sys,io
import math
from collections import deque
from heapq import heappush, heappop

input = sys.stdin.buffer.readline

def sRaw():
    return input().decode("utf-8").rstrip("\n").rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7


def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac = fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV

    return CONV()


def cumsum(As):
    s = 0
    for a in As:
        s += a
        yield s


sys.setrecursionlimit(200005)


def dijkstra(G,start=0):
    heap = []
    cost = [INF]*len(G)
    heappush(heap,(0,start))
    while len(heap)!=0:
        c,n = heappop(heap)
        if cost[n] !=INF:
            continue
        cost[n]=c
        for e in G[n]:
            ec,v = e
            if cost[v]!=INF:
                continue
            heappush(heap,(ec+c,v))
    return cost


def main():
    S= sRaw()
    T =sRaw()
    ans = 10**10
    for sidx in range(0,len(S)-len(T)+1):
        score = sum([1 for idx in range(len(T)) if S[sidx+idx]!=T[idx]])
        ans=min(score,ans)
    print(ans)

main()

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

s_len = len(S)
t_len = len(T)
R = s_len - t_len
ans = 1000

for i in range(R + 1):
  s_new = S[i : t_len + i]
  count = 0
  for j in range(t_len):
    if s_new[j] != T[j]:
      count += 1
  ans = min(ans, count)

print(ans)

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

def compare( s, t ):
    count = 0
    for i in range( len( s ) ):
        if s[ i ] != t[ i ]:
            count += 1
    return count

ans = 10 ** 10
for i in range( len( s ) - len( t ) + 1 ):
    ans_i = compare( s[ i : i + len( t ) ], t )
    if ans_i < ans or i == 0:
        ans = ans_i

print( ans )

Solution (Python):
s=input()
t=input()
ans=[]
for i in range(len(s)-len(t)+1):
    ts=s[i:i+len(s)]
    c=0
    for x,y in zip(t,ts):
        if x==y:
            c+=1
    ans.append(c)
print(len(t)-max(ans))

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

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

print(ans)

Solution (Python):
import numpy as np
import difflib
S,T = [input() for i in range(2)]
lent=len(T)
lens=len(S)
min=10000
for i in range (0,lens-lent+1):
  now=S[i:i+lent]
  curnum=0
  for j in range(0,lent):
    if now[j]!=T[j]:
      curnum=curnum+1
  if curnum<min:
    min=curnum
print(min)

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

res = 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
    res = max(res, tmp)

print(len(T) - res)

Solution (Python):

def check(s,t):
    count=[]
    if t in s:
        return 0
    else    :
        for i in range(len(s)-len(t)+1):
            count.append(0)
            for j in range(len(t)):
                if not t[j]==s[i+j]:
                    count[i]+=1
    return min(count)
if __name__ == '__main__':
    s = input().rstrip()
    t= input().rstrip()

    print(check(s,t))

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

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


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

nux = 0
for i in range(1000):
    count = 0
    if i+nt-1 >= ns:
        break
    for j in range(nt):
        if s[i+j] == t[j]:
            count += 1

    nux = max(nux, count)

print(nt-nux)

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

def count_letter(A,B):
  score=0
  for i in range(len(A)):
    if A[i]==B[i]:
      score+=1
  return score

count_max=0
for i in range(len(S)-len(T)+1):
  count_max=max(count_max,count_letter(S[i:i+len(T)],T))
print(len(T)-count_max)

Solution (Python):
def solve(s, t):
    c = 0
    for i, j in enumerate(s):
        if j != t[i]:
            c += 1
    return c


S = input()
T = input()

count = 0
ans = float("inf")
while count + len(T) <= len(S):
    a = solve(S[count:count + len(T)], T)
    if ans > a:
        ans = a
    count += 1

print(ans)

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()

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

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

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

ans = tl
def check(t, s):
    temp = 0
    for i in range(len(t)):
        if t[i] != s[i]:
            temp += 1
        else:
            pass
    return temp
for i in range(sl-tl+1):
    if ans > check(t,s[i:i+tl]):
        ans = check(t,s[i:i+tl])
    else:
        pass
print(ans)

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

min_cnt = 9999999999
for i in range(0, len(S) - len(T)+1):
    s = S[i: i + len(T)]
    cnt = 0
    for m, n in zip(s, T):
        if m != n:
            cnt +=1
    min_cnt = min(min_cnt, cnt)

print(min_cnt)

Solution (Python):
S = list(input())
T = list(input())
a = []

for i in range(len(S)-len(T)+1):
    n = 0
    for j in range(len(T)):
        if S[j+i] == T[j]:
            n += 1
        else:
            continue
    a.append(n)

print(len(T)-max(a))

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

print(ans)

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

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

Solution (Python):
S=input()
T=input()
num=len(S)
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
    if x<=num:
        num=x
print(num)

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

def solve(a, b):
	l = len(b)
	maxx = -1
	for i in range(len(a)-l+1):
		val = diff(b, a[i:i+len(b)])
		maxx = max(maxx, val)
	return l - maxx

a = input()
b = input()
print(solve(a, b))

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

print(x - z)

Solution (Python):
S = input()
T = input()
L = len(T)
ans = L
for i in range(len(S)-L+1):
    s = S[i:i+L]
    cnt = 0
    for cs, ct in zip(s, T):
        if cs!=ct: cnt+=1
    ans = min(ans, cnt)
print(ans)

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

max_num = 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 max_num < count:
    max_num = count
    

print(len(T)-max_num)

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