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 = input()
t = input()
l = len(t)
ans = 0
a = 0
list1 = [0]
for i in range(len(s) - l + 1):
  ss = list(s[i:i+l])
  for j in range(l):
    if ss[j] ==t[j]:
      ans += 1
      list1.append(ans)
    else:
      pass
  ans = 0
m =  max(list1)
print(l-m)

Solution (Python):

def cout_dif(a, b):
    sum = 0
    for i in range(len(a)):
        if a[i] != b[i]:
            sum += 1
    return sum
    
def main():
    s = input()
    t = input()
    min = 10**5
    for i in range(len(s)-len(t)+1):
        sum = cout_dif(t, s[i:i+len(t)])
        if sum < min:
            min = sum
    print(min)

if __name__ == '__main__':
    main()

Solution (Python):
s = input()
t = input()
n = int(len(s)) - int(len(t)) + 1
kari = []

for i in range(n):
    kari.append(s[i:i+int(len(t))])

ans = []
n_2 = int(len(t))
for j in kari:
    t_2 = 0
    for k in range(n_2):
        if j[k] == t[k]:
            t_2 += 1
    ans.append(n_2-t_2)

print(min(ans))

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

slen = len(s)
tlen = len(t)
arr = []
upto = slen - tlen + 1 

for i in range(upto):
    c = (s[i:i+tlen])
    d = 0
    for j in range(tlen):
        if t[j] != c[j]:
            d += 1
    arr.append(d)
    
print(min(arr))

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

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

s = input().strip()
t = input().strip()

sn = np.array([ord(a) for a in s])
tn = np.array([ord(a) for a in t])
mi = 1000
if t in s:
    print(0)

else:
    l = len(tn)
    for i in range(len(sn)-l+1):
        tt = sn[i:i+l] -tn
        mi = min(len(np.nonzero(tt)[0]), mi)
    print(mi)

Solution (Python):
S = input()
T = input()
cnt = len(S)-len(T)+1
res = []
for i in range(cnt):
    res2 = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            res2 += 1
    res.append(res2)
print(min(res))

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

Solution (Python):
def main():
  S = list(input())
  T = list(input())
  
  l_S = len(S)
  l_T = len(T)
  
  best = l_S
  
  for i in range(l_S - l_T + 1):
    X = S[i : i + l_T]
    count = l_T
    for j, y in enumerate(X):
      if T[j] == y:
        count -= 1
    if best > count:
      best = count
    
  print(best)
    
main()

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

x = 0
y = 0

answer = 0

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

print(len(t) - answer)

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

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

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

Solution (Python):
s,t = raw_input(),raw_input()
m = len(t)

def f(s,t):
	if len(s) < len(t):
		return +float('inf')
	c = 0
	for u,v in zip(s,t):
		if u != v:
			c+=1
	return c
for i in range(len(s)):
	m = min(m,f(s[i:i+len(t)],t))
print m

Solution (Python):
s = input()
t = input()
ratio = []
cnt = 0
if len(s) == len(t):
    for i in range(len(t)):
        if s[i] == t[i]:
            cnt += 1
    ratio.append(cnt)
else:
    for k in range(len(s) - len(t)):
        for i in range(len(t)):
            if s[i + k] == t[i]:
                cnt += 1
        ratio.append(cnt)
        cnt = 0
res = len(t) - max(ratio)
print(res)

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

Solution (Python):
S=input()
T=input()
SL=len(S)
TL=len(T)

def match(x,y):
  c=0
  for i in range(TL):
    if x[i]==y[i]:
      c+=1
  return c

max_match=0
for j in range(SL-TL+1):
  m=match(S[j:],T)
  max_match=max(max_match,m)

print("{}".format(TL-max_match))

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

N = len(T)
count = 0
count_list = []
index_list = []

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

    for i in range(len(index_list)):
        count = 0
        for j in range(N):
            if index_list[i][j] == T[j]:
                count +=1
        count_list.append(count)
                
    print(N - max(count_list))
else:
    for i in range(N):
        if S[i] == T[i]:
            count += 1
    print(N - count)

Solution (Python):
def check(a,b):
    cnt=0
    for x in range(len(a)):
        if a[x]!=b[x]:
            cnt+=1
    return cnt        
s=input()
t=input()
k=len(t)
ans=k
for x in range(len(s)-len(t)+1):
    ans=min(ans,check(s[x:x+k],t))
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline  
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))



def a_int(): return int(readline())


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


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, readline().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  
from functools import reduce
from math import gcd


def lcm(a, b):
    
    g = gcd(a, b)
    return a // g * b


S = input()
T = input()


def n_rewrite(S, T):
    assert len(S) == len(T), (S, T)
    ret = 0
    for s, t in zip(S, T):
        if s != t:
            ret += 1
    return ret


ans = 10**9
for i in range(len(S) - len(T) + 1):
    ans = min(ans, n_rewrite(T, S[i:i + len(T)]))

print(ans)

Solution (Python):
s=input()
l=input()
a=len(l)
big=0
for i in range(len(s)-a+1):
    cnt=0

    for j in range(i,i+a):
        if s[j]==l[j-i]:
            cnt+=1
    if cnt>big:
        big=cnt
print(a-big)

Solution (Python):
def main():
    s = input()
    t = input()
    ans = 0
    substr = ''
    len_s = len(s)
    len_t = len(t)
    if t in s:
        print(0)
    else:
        for i in range(len_s - len_t + 1):
            substr = s[i: i + len_t]
            tmp = 0
            for sn, tn in zip(substr, t):
                if sn == tn:
                    tmp += 1
            ans = max(ans, tmp)
            if ans == len_t - 1:
                break
        print(len(t) - ans)


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
T = input()
s = len(S)
t = len(T)
L = [""]*(s-t+2)
match = [0]*(s-t+1)


for p in range(s-t+1):
    for q in range(t):
        L[p] += S[p+q]

for r in range(s-t+1):
    for s in range(t):
        if L[r][s] == T[s]:
            match[r] += 1

print(t-max(match))

Solution (Python):



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


lt = len(T)
ls = len(S)
count = []
for i in range(ls-lt+1):
    counter = 0
    for j in range(lt):
        if S[j] != T[j]:
            counter += 1
    count.append(counter)
    del S[0]

print(min(count))

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

Solution (Python):
S=input()
T=input()
LS=len(S)
LT=len(T)
ans=0

for i in range(LS-LT+1):
    cnt=0
    kari=S[i:i+LT]
    for j in range(LT):
        if kari[j]==T[j]:
            cnt+=1
    
    ans=max(cnt,ans)        

print(LT-ans)

Solution (Python):
import math
min = math.inf
S = input()
T = input()

len_t = len(T)
for s in range(0,len(S)-len_t+1):
    sub = S[s: s+len_t]
    diff = 0
    for i in range(len_t):
        if sub[i] != T[i]:
            diff += 1
            if diff > min:
                break
    else:
        if diff < min:
            min = diff
print(min)

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

result = len(T)
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
    result = min(result, n)

print(result)

Solution (Python):
s = input()
t = input()
ans = 0
max = 0

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

Solution (Python):

list_1 = list(str(input()))
list_2 = list(str(input()))

int_agg_count_max_diff = 10000
for i in range(len(list_1) - len(list_2) + 1):
  list_1_tmp = list_1[i:i+len(list_2)]
  
  int_count_max_diff = 0
  for j in range(len(list_2)):
    if list_1_tmp[j] != list_2[j]:
      int_count_max_diff = int_count_max_diff + 1
  if int_agg_count_max_diff > int_count_max_diff:
    int_agg_count_max_diff = int_count_max_diff
print(int_agg_count_max_diff)

Solution (Python):
s=input()
t=input()
n=len(s)
k=len(t)
l=[]
for i in range(n-k+1):
    count=0
    for j in range(k):
        if(s[i+j]!=t[j]):
            count+=1
    l.append(count)
print(min(l))

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

s_len = len(S)
t_len = len(T)

Ss = list(S)
Ts = list(T)

answer = 9999

for si in range(s_len):
    candidate = 0
    if si + t_len > s_len:
        continue

    for ti in range(t_len):
        if Ss[si + ti] != Ts[ti]:
            candidate += 1

    if candidate < answer:
        answer = candidate

print(answer)

Solution (Python):
S = input()
T = input()
ss = len(S)
tt = len(T)
a = tt
for r in range(ss - tt + 1):
    n = 0
    for x in range(tt):
        z = S[r:r+tt]
        if z[x] != T[x]:
            n += 1
    a = min(a, n)
print(a)

Solution (Python):

"""
Created on Sat Aug 29 20:26:17 2020

@author: wiste
"""

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


cm = 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
    cm = max(cm, c)

ans = len(T) - cm


print(ans)

Solution (Python):
import sys
import re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []


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

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


    print(min)

    return

if __name__ == '__main__':
    main()

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

ans = float("Inf")

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

print(ans)

Solution (Python):

def char_match(s,t,m):
    match = 0
    for i in range(m):
        if s[i] == t[i]:
            match += 1
    return match
def substring(S,T):
    m = len(T)
    char_mismatch = m
    for i in range(0,(len(S)-m) +1):
        char_mismatch = min(char_mismatch, m - char_match(S[i:i+m],T, m))
    return char_mismatch

def start():
    S = input()
    T = input()
    print(substring(S,T))
start()

Solution (Python):
if __name__ == "__main__":
    s = input()
    t = input()

    test1  = len(s) - len(t) + 1

    test3 = []
    for i in range(test1):
        test2 = s[i:i+len(t)]
        test4 = 0
        for j in range(len(test2)):
            if test2[j] == t[j]:
                test4 += 1
        test3.append(test4)

    print(len(t)-max(test3))

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

t_len = len(t)
s_len = len(s)
max_ = 0
temp = 0

for i in range(s_len - t_len + 1):
  for j in range(t_len):
    if s[i + j] == t[j]:
      temp += 1
  if max_ < temp:
    max_ = temp
  temp = 0

print(t_len - max_)

Solution (Python):
s = input()
t = input()
if t in s:
    print(0)
else:
    count = 0
    val = 10001
    for j in range(len(s)-len(t)+1):
        k = 0
        count= 0
        for i in range(j,len(t)+j):
            if s[i]!=t[k]:
                count+=1
            k+=1
        val = min(val,count)
    print(val)

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

min = 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
    
    if diff < min:
        min = diff
    
    
print(min)

Solution (Python):
S=list(input())
T=list(input())
b=0
c=len(T)


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

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

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

Solution (Python):
S=str(input())
T=str(input())
ls = []
cnt = 0
for i in range(len(S)-len(T)+1):
    cnt = 0
    for j in range(len(T)):
        
        if T[j] != S[j+i]:
            
            cnt += 1
    ls.append(cnt)

print(min(ls))

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

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

max = 0
max_i = 0
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
    if cnt > max:
        max = cnt
        max_i = i
        ans = len(T) - max

print(ans)

Solution (Python):
S = input()
T = input()
count = 0
lenS = len(S)
lenT = len(T)
ans = lenT

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

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

def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')

from collections import deque, defaultdict





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

    nt = len(T)
    ans = INF
    for i in range(0, len(S)-nt+1):
        
        ss = S[i: i+nt]
        cnt = 0
        for j, s in enumerate(ss):
            if s == T[j]:
                pass
            else:
                cnt += 1
        ans = min(ans, cnt)
    print(ans)


if __name__ == '__main__':
    solve()

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

nmax=len(t)
nmin=len(t)

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

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

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

n, m = len(s), len(t)

ma = 0
for i in range(n-m+1):
    tmp = 0
    s_sub = s[i:i+m]
    for j in range(m):
        if s_sub[j] == t[j]:
            tmp += 1
    ma = max(ma, tmp)

print(m - ma)

Solution (Python):

S = str(input())
T = str(input())
x = 0
ans = 100000000

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

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

Solution (Python):
from sys import exit, stdin

input = stdin.readline
import copy




(S,) = input().split()
(T,) = input().split()


ans = 10000
for i in range(len(S) - len(T) + 1):
    cnt = 0
    tmp = S[0 + i : len(T) + i]
    for s, t in zip(tmp, T):
        if s != t:
            cnt += 1
    if cnt == 0:
        ans = 0
        break
    else:
        if ans > cnt:
            ans = cnt


print(ans)

Solution (Python):








import sys,collections

S = sys.stdin.readline().rstrip()
T = sys.stdin.readline().rstrip()
SN = len(S)
TN = len(T)
m = 0

for i in range(SN-TN+1):
    t = 0
    for j in range(TN):
        if T[j]==S[i+j]:
            t += 1
    m = max(m,t)
print(TN-m)

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

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

print(ans)

Solution (Python):
S = str(input())
T = str(input())
substis = []
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
    substis.append(len(T)-count)
print(min(substis))

Solution (Python):


import sys

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

def main():
    s = input()
    t = input()
    ans_list=[]
    ans=[]
    count=0

    ans_list=n_gram(s,len(t))

    for word in ans_list:
        for str1,str2 in zip(word,t):
            if str1==str2:
                count+=1
        ans.append(count)
        count=0
    print(len(t)-max(ans))

if __name__ == "__main__":
    main()

Solution (Python):
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


s = S()
t = S()
if s == t:
    print(0)
    exit()

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

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

len_s = len(s)
len_t = len(t)
count = 0
biggest = 0

for i in range(len_s-len_t+1):
  now = s[i:i+len_t]

  for j in range(len_t):
    if t[j] == now[j]:
      count += 1
      
  if biggest < count:
    biggest = count
    count = 0
  else:
    count = 0
    
print(len_t - biggest)

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

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

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

Solution (Python):
S = input()
T = input()
ans = len(T)
if len(T)==len(S):
    loop = 1
else:
    loop = len(S)-len(T)
for i in range(loop):
    diff = 0
    for s, t in zip(S[i:i+len(T)], T):
        if s!=t:
            diff += 1
    ans = min(ans, diff)
print(ans)

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


def matchCount(str1, str2):
    count = 0
    if str1 == str2:
        return len(str1)
    for i in range(len(str1)):
        if str1[i] == str2[i]:
            count = count + 1
    return count



lenT = len(T)
maxCount = 0
for i in range(len(S) - lenT + 1):
    token = S[i:i + lenT]
    count = matchCount(token, T)
    if count > maxCount:
        maxCount = count

print(lenT - maxCount)

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

dist = len(T)

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

print(dist)

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

ss = len(S)
tt = len(T)

count = 0
res = []


for i in range(ss-tt+1):
    for j in range(tt):
        if S[i+j] != T[j]:
            count += 1
    res.append(count)
    count = 0

print(min(res))

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

n = [0]*(len(s) - len(t) + 1)

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

print(len(t) - max(n))

Solution (Python):

import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline


def array(size, init=0):
    return [[init for j in range(size[1])] for i in range(size[0])]


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


def II():
    return int(input())


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


S = input()
T = input()


lt = len(T)
res = 0
for i in range(0, len(S)-len(T)+1):
    res = max(res, nitti(S[i:(i+lt-1)], T))
    


print(lt-res-1)

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

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

max_score = 0
for i in range(len(s)-len(t)+1):
    match = zip(t, s[i:i+len_t])
    score = sum([1 for x in match if x[0]==x[1]])
    max_score = max(max_score, score)
print(len_t - max_score)

Solution (Python):
def resolve():
    S = input()
    T = input()
    mincnt = float("inf")
    for ptr in range(len(S)-len(T)+1):
        cnt = 0
        for i in range(len(T)):
            sptr = ptr + i
            if S[sptr] != T[i]:
                cnt += 1
        mincnt = min(cnt, mincnt)
    print(mincnt)



    
if '__main__' == __name__:
    resolve()

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

if __name__ == "__main__":
    solve()

Solution (Python):
S = list(input())
T = list(input())
A = []
count = 0

for x in range(0, len(S)-len(T)+1):
    for y in range(0, len(T)):
        if(S[x+y] != T[y]):
            count += 1
        else:
            pass
    A.append(count)
    count = 0

print(min(A))

Solution (Python):
s=input()
t=input()
ans=10**3+1
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()
Min = len(t)

for i in range(len(s)-len(t)+1):
    cont = len(t)
    for j in range(len(t)):
        if s[i+j] == t[j]:
            cont -= 1
            
    if cont < Min:
        Min = cont


print(Min)

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

s_len = len(s)
t_len = len(t)
min_count = t_len

j = 0
while j+t_len <= s_len:
    sub_s = s[j:j+t_len]
    
    count = 0
    for i in range(t_len):
        if sub_s[i] != t[i]:
            count += 1
            
    if count < min_count:
        min_count = count

    j+=1
        
print(min_count)

Solution (Python):
import sys

S = input()
T = input()

if len(S) == len(T):
    changeCounter = 0
    for j in range(len(S)):
        if not S[j] == T[j]:
            changeCounter += 1
    print(changeCounter)
    sys.exit()

minChangeCounter = 1000000
for i in range(len(S) - len(T)):
    substr = S[i:i + len(T)]
    changeCounter = 0
    for j in range(len(T)):
        if not substr[j] == T[j]:
            changeCounter += 1
    if changeCounter < minChangeCounter: minChangeCounter = changeCounter
print(minChangeCounter)

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

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

print(len(T)-match_n)

Solution (Python):
s=input()
n1=len(s)
t=input()
n=len(t)
mini=int(1e9)
start=0
end=n-1
md=0
while end!=n1:
    md=0
    j=0
    for i in range(start,end+1,1):
        if s[i]!=t[j]:
            md+=1
        j+=1
    mini=min(mini,md)
    start+=1
    end+=1
print(mini)

Solution (Python):
import sys



def input():
    return sys.stdin.readline().strip()


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


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    S = input()
    T = input()
    size = len(T)
    ans = 10**9
    for i in range(len(S) - size + 1):
        _s = S[i:i + size]
        tmp = 0
        for j in range(size):
            if _s[j] != T[j]:
                tmp += 1
        ans = min(ans, tmp)
    print(ans)
    return


if __name__ == "__main__":
    main()

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

T_length = len(T)
max_count = 0

for i in range(len(S)-T_length+1):
  count = 0
  for j in range(T_length):
    if S[i:i + T_length][j] == T[j]:
      count += 1
  else:
    if max_count < count:
      max_count = count

print(T_length - max_count)

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

cnt = 10 ** 9
for i in range(len(S) - len(T) + 1):
    tmp = 0
    for j in range(len(T)):
        if i + j < len(S) and S[i + j] == T[j]:
            continue
        else:
            tmp += 1
    cnt = min(cnt, tmp)

print(cnt)

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

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

cnt = 10 ** 9
for i in range(len(S) - len(T) + 1):
    tmp = 0
    for j in range(len(T)):
        if i + j < len(S) and S[i + j] == T[j]:
            continue
        else:
            tmp += 1
    cnt = min(cnt, tmp)

print(cnt)

Solution (Python):
input_n = input()
n = str(input_n)

listS = list(n)


input_m = input()
m = str(input_m)

listT = list(m)

min = 10000

if (len(listS) - len(listT)) == 0:
    tmp = 0
    for j in range(len(listT)):
        if listS[j] != listT[j]:
            tmp += 1
    if tmp < min:
        min = tmp

for i in range(len(listS) - len(listT)):
    tmp = 0
    for j in range(len(listT)):
        if listS[i + j] != listT[j]:
            tmp += 1
    if tmp < min:
        min = tmp

print(str(min))

Solution (Python):
s=input()
t=input()
sl=len(s)
tl=len(t)

cnt=0
ans=0

for i in range(sl-tl+1):
    for j in range(tl):
        if t[j] == s[i+j]:
            cnt+=1
    
    ans=max(cnt, ans)
    cnt=0

print(tl-ans)

Solution (Python):
import sys
import math
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
s=input()
t=input()
ans=0
flag=0
for j in range(len(s)-len(t)+1):
    flag=0
    for i in range(len(t)):
        if s[i+j]==t[i]:
            flag=flag+1
    if flag>ans:
        ans=flag
print(len(t)-ans)

Solution (Python):
S=input().strip()
T=input().strip()
ls = len(S)
lt = len(T)

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

print(x)

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

best_num_char=0
for i in range(len(S)-len(T)+1):
    
    num_char=0
    for j in range(len(T)):
        num_char+=1 if S[i+j]==T[j] else 0
        
    if best_num_char<num_char:
        best_num_char=num_char


print(len(T)-best_num_char)

Solution (Python):
input_list = [input() for i in range(2)]
M = input_list[0]
N = input_list[1]

ans = []

for i in range(len(M)-len(N)+1):

    num = 0

    substring = input_list[0][i:i+len(N)]

    for j in range(len(N)):

        if substring[j] != N[j]:

            num += 1

    ans.append(num)

print(min(ans))

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

match_ans = 0

for i in range(len(s)-len(t)+1):
    tgt_pos = i
    match_cnt = 0
    for j in range(len(t)):
        if s[tgt_pos+j] == t[j]:
            match_cnt += 1
    match_ans = max(match_ans,match_cnt)

print(len(t) - match_ans)

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

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