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()
if S.find(T) != -1:
    min = 0
else:
    min = float('inf')
    r = len(S) - len(T)
    for i in range(r+1):
        t = 0
        for j, v in enumerate(T):
            t += int(S[i+j] != v)
        if min > t:
            min = t

print(min)

Solution (Python):
S = input()
T = input()
s = len(S)
t = len(T)

ans = 1000

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

print(ans)

Solution (Python):
S = input()
T = input()
M = len(S)
N = len(T)

ans = N
diff = M - N

for i in range(diff + 1):
    U = '0' * i + T
    count = N
    for j in range(N + i):
        if U[j] == S[j]:
            count -= 1
    ans = min(ans, count)
print(ans)

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

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

if ls == lt:
    tmp = s[0:lt]
    score = 0
    for j in range(lt):
        if tmp[j] != t[j]:
            score += 1
    print(score)
    exit()

ans = 10000000
for i in range(ls - lt):
    tmp = s[i:i+lt]
    score = 0
    for j in range(lt):
        if tmp[j] != t[j]:
            score += 1
    ans = min(ans, score)

print(ans)

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

b = 1000

for i in range(len(S) - len(T) + 1):
  a = 0
  for j in range(len(T)):
    if list(S[i + j]) == list(T[j]):
      a = a
    elif list(S[i + j]) != list(T[j]):
      a += 1
  if a < b:
    b = a
  else:
    b = b

print(b)

Solution (Python):
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007



def kotonaru_num(a, b):
	if len(a) != len(b):
		return 1/0
	ret = 0
	for c, s in zip(a, b):
		if c != s:
			ret += 1
			
	return ret
 

def main():
	
	
	s = input()	
	t = input()
	ret = mod
	for i in range(len(s) - len(t)+1):
		cc = s[i:i+len(t)]
		
		tr = kotonaru_num(cc, t)
		ret = min(ret, tr)
	print(ret)
		
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Solution (Python):
S = str(input())
T = str(input())
mini = []

if len(S) != len(T):
    for i in range(len(S) - len(T)):
        count = 0
        for j in range(len(T)):
            if T[j] == S[j+i]:        
                count+=1
        mini.append(len(T) - count)
    print(min(mini))
else:
    count = 0
    for i in range(len(S)):
       if T[i] == S[i]:
           count+=1
    print(len(T) - count)

Solution (Python):
s = list(input())
t = list(input())
ans = []
if len(s)-len(t) == 0:
  an = 0
  for j in range(len(t)):
      if s[j] == t[j]:
        an += 1
  print(len(t)-an)
else:
  for i in range(len(s)-len(t)):
    ans.append(0)
    for j in range(len(t)):
      if s[i+j] == t[j]:
        ans[i] += 1
  print(len(t) - max(ans))

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

Solution (Python):
s = input()
t = input()
cnt = 0
min = 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 min < cnt:
        min = cnt
ans = len(t)-min

s = s[::-1]
t = t[::-1]
cnt=0
min=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 min < cnt:
        min = cnt
if ans > len(t)-min:
    ans = len(t)-min
f = s.find(t)
if f < ans and f != -1:
    ans = f
print(ans)

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

Solution (Python):
S = input()
T = input()
Slist = list(S)
Tlist = list(T)
Ulist = []
ans = len(T)
count = 0

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

print(ans)

Solution (Python):
S = input()
T = input()
buf =[]
for i in range(len(S)-len(T)+1):
    A=S[i:(i+len(T))]
    same = 0
    for j in range(len(T)):
        if A[j]==T[j]:
            same+=1
    buf.append(same)
print(len(T)-max(buf))

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

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

ans = sys.maxsize


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

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

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

if S.count(T) > 0:
    print(0)
    exit()

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

Solution (Python):
S = input()
T = input()
Sli = list(S)
Tli = list(T)
cli = []

for i in range(len(Sli) - len(Tli) + 1):
    c = len(Tli)
    for j in range(len(Tli)):
        if Sli[i + j] == Tli[j]:
            c -= 1
    cli.append(c)

print(min(cli))

Solution (Python):
s=input()
t=input()
y=len(t)
z=len(s)
yy=y
for i in range(0,(z-y+1)):
    xx=i+y
    s1=s[i:xx]
    ct=0
    
    for j in range(0,y):
        if(s1[j]==t[j]):
            ct+=1
    z=y-ct
    if(z<yy):
        yy=z
print(yy)

Solution (Python):
import numpy as np
s = input()
t = input()
strs = []
t_size = len(t)
for i in np.arange(len(s)-len(t)+1):
    strs.append(s[i:i+t_size])
n = 0
max_n = 0
for ss in strs:
    for i in np.arange(len(t)):
        if t[i]==ss[i]:
            n += 1
        if max_n < n:
            max_n = n
    n = 0
print(len(t)-max_n)

Solution (Python):
import math

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

Solution (Python):
S = input()
s = list(S)
T = input()
t = list(T)
ss = len(s)
tt = len(t)
ll = ss - tt +1

A = [[] for _ in range(ll)]

for i in range(ll):
  for j in range(tt):
    A[i].append(s[int(i)+int(j)])
    
d = tt

for i in range(ll):
  e = 0
  for j in range(tt):
    if A[i][j] != t[j]:
      e += 1
  if e<d:
    d = e
  else:
    d = d
    
print(d)

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

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


m = 0
for i in range(ls-lt+1):
    tmp = S[i:i+lt]
    cnt = 0
    for idx,j in enumerate(tmp):
        if T[idx]==j:
            cnt+=1
    m = max(cnt,m)

print(lt-m)

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


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

print(len(T)-num_same_all)

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

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

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

Solution (Python):
s = input()
t = input()
n = len(s)-len(t)+1
tn = len(t) 

ans = tn
for i in range(n):
    si = s[i:i+tn]
    cnt = 0
    for j in range(tn):
        if si[j] != t[j]:
            cnt += 1
    ans = min(ans, cnt)

print(ans)

Solution (Python):
s=list(input())
t=list(input())
score=[]
for i in range(len(s)-len(t)+1):
  point=0
  for j in range(len(t)):
    if s[i+j]==t[j]:
      point+=1
  score.append(point)
cnt=0
w=max(score)
w_iti=score.index(w)
for i in range(len(t)):
  if s[w_iti+i] != t[i]:
    cnt += 1
print(cnt)

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

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

    max_score = 0
    if len(s) == len(t):
        max_score = sum([s[j] == t[j] for j in range(len(t))])
    else:
        for i in range(0, len(s) - len(t)):
            score = sum([s[i + j] == t[j] for j in range(len(t))])
            if max_score < score:
                max_score = score
    print(len(t) - max_score)

Solution (Python):









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

    min_len = len(T)
    for i, s in enumerate(S[:len(S)-len(T)+1]):
        sub = S[i:i+len(T)]
        
        count = 0
        for j, t in enumerate(T):
            if sub == T:
                break
            if sub[j] == t:
                continue
            sub = sub[:j] + t + sub[j+1:]
            count += 1

        min_len = min(min_len, count)

    return min_len


def main():
    print(solve())


if __name__ == "__main__":
    main()

Solution (Python):
S = str(input())
T = str(input())
m = len(S)
n = len(T)
mn = m
for i in range(m-n+1):
    sub = S[i:i+n]
    counter = 0
    for j in range(n):
        if sub[j] != T[j]:
            counter += 1
    if mn > counter:
       mn = counter 
print(mn)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log  
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint


def ceil(a, b): return (a + b - 1) // b


inf = float('inf')
mod = 10 ** 9 + 7


def pprint(*A):
    for a in A:     print(*a, sep='\n')


def INT_(n): return int(n) - 1


def MI(): return map(int, input().split())


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [I() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


def I(): return int(input())


def F(): return float(input())


def ST(): return input().replace('\n', '')
import sys
import itertools
import copy


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

    if T in S:
        print(0)
        sys.exit()
    len_s = len(S)
    len_t = len(T)
    diff = len_s - len_t
    match_list = []

    if len_t == len_s:
        cnt_match = 0
        for j in range(len_t):
            if S[j] == T[j]:
                cnt_match+=1
        match_list.append(cnt_match)
        print(len_t - max(match_list))
        sys.exit()

    for i in range(diff):
        cnt_match = 0
        for j in range(len_t):
            if S[j + i] == T[j]:
                cnt_match+=1
        match_list.append(cnt_match)
    
    
    
    

    print(len_t - max(match_list))
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    


    
    
    
    
    

if __name__ == '__main__':
    main()

Solution (Python):
a = input()
b = input()

l = []
for i in range(len(a) - len(b) + 1):
    cnt = 0
    for j in range(len(b)):
        if b[j] == a[i + j]:
            cnt += 1
    l.append(cnt)


print(len(b) - max(l))

Solution (Python):
main = input()
word = input()
temp = main
resultArray = []
final = len(word)
for j in range(len(main) - (len(word) - 1)):
    result = ''
    for i in range(len(word)):
        if main[j + i] == word[i]:
            result += '1'
        else:
            result += '0'
    resultArray.append(result)
for i in resultArray:
    if i.count('0') < final:
        final = i.count('0')
print(final)

Solution (Python):
S = input()
T = input()
N = len(S)
n = len(T)
ans = 0

x = 0
y = 0
s = ''
for i in range(N - n + 1):
    s = S[i:i + n]
    for j in range(n):
        if s[j] == T[j]:
            x += 1
    ans = max(ans, x)
    x = 0
ans = n - ans
print(ans)

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

Sn = len(S)
Tn = len(T)

ans = 0

for i in range(Sn - Tn + 1):
    L = S[i:i + Tn]
    ans_ = 0
    for j, k in zip(L, T):
        if j == k:
            ans_ += 1
    ans = max(ans, ans_)

print(Tn - ans)

Solution (Python):
def resolve():
    '''
    code here
    '''

    S = input()
    T = input()

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

        print(len(T) - res)


if __name__ == "__main__":
    resolve()

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

l = len(t)
same = 0
for i in range(len(s)-len(t)+1):
    count = 0
    for j in range(len(t)):
        if s[i+j] == t[j]:
            count += 1
    if count > same:
        same = count

print(len(t) - same)

Solution (Python):
S=str(input())
T =str(input())
c=len(T)
for i in range(len(S)-len(T)+1):
    count=len(T)
    for n in range(len(T)):
        if S[i+n] == T[n]:
            count -=1
       
    
    
    
    if count <c:
        c=count
print(c)

Solution (Python):
import sys

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

ans = lt
for i in range(ls -lt + 1):
  tmp = lt
  for j in range(lt):
    if s[i + j] == t[j]:
      tmp -= 1
  ans = min(ans, tmp)
  if ans == 0:
    print(0)
    sys.exit()
  
print(ans)

Solution (Python):
import sys 

string1 = str(input())
string2 = str(input())

n, m = len(string2), len(string1) 

ans = sys.maxsize 
for i in range(m - n + 1): 
    minRemovedChar = 0 
    for j in range(n): 
        if (string2[j] != string1[i + j]): 
            minRemovedChar += 1
    ans = min(minRemovedChar, ans) 

print(ans)

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

s = input()
t = input()



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

ans = tl

tmp1 = s[0:tl]
tmp2 = t 

ans = min(tl - compute(tmp1,tmp2), ans)


for i in range(sl-tl):
	tmp1 = s[i:i+tl]
	tmp2 = t
	ans = min(tl - compute(tmp1,tmp2), ans)
	

print(ans)

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

def count_diff2(a,b):
    cnt = 0
    for c1,c2 in zip(a, b):
        if c1 != c2:
            cnt += 1
    return cnt

temp = 0
ans = len(T)

for i in range(len(S)-len(T) + 1) :
    temp = count_diff2(T, S[i:len(T) + i])
    if temp < ans:
        ans = temp

print(ans)

Solution (Python):


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

S = input()
T = input()
min_ = 9999999
for i in range(len(S)-len(T)):
  str1 = S[i:i+len(T)]
  str2 = T
  
  leven = Levenshtein(str1,str2)
  if(leven < min_):
    min_ = leven
if len(S)==len(T):
  if S==T:
    min_=0
  else:
    min_=Levenshtein(S,T)
print(min_)

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[j+i] == T[j]:
            cnt += 1
    res = max(res, cnt)
print(len(T) - res)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")


def solve():
    s = S()
    t = S()
    ans = inf
    for i in range(len(s) - len(t) +1):
        tmp = 0
        for j in range(len(t)):
            if s[i + j] == t[j]:
                continue
            tmp += 1
        ans = min(ans, tmp)
    print(ans)
    return



if __name__ == '__main__':
    solve()

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

n = len(t)

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

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

while len(T) <= len(S):
  cnt = 0
  for(SL,TL) in zip(list(S),list(T)):
    if SL != TL:
      cnt = cnt + 1
  
  if MIN > cnt:
   MIN = cnt
  
  S = S[1:]

print(MIN)

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

length_s, length_t = len(S), len(T)

dif = length_s-length_t+1

res = 0
for i in range(dif):
    st = sum(1 if s == t else 0 for s, t in zip(S[i:i+length_t], T))
    res = max(res, st)

print(length_t-res)

Solution (Python):
def check(S,T,i):
	count=0
	for j in range(i,len(T)+i):
		if S[j] != T[j-i]:
			count+=1
	return count

S=input()
T=input()
b=[]
for i in range(0,len(S)-len(T)+1):
	b.append(check(S,T,i))
b.sort()
print(b[0])

Solution (Python):
import sys
def minimumchar(s1,s2):
	n,m=len(s1),len(s2)
	ans=sys.maxsize
	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
	
s2=input()
s1=input()

print(minimumchar(s1,s2))

Solution (Python):
s = str(input())
t = str(input())
cnt = 0
s_len = len(s)
t_len = len(t)
sa = s_len - t_len
Max = 0
for i in range(len(s) - len(t) + 1):
    ss = s[i:i+len(t)]
    for j in range(len(t)):
        if ss[j] == t[j]:
            cnt += 1
    Max = max(Max,cnt)
    cnt = 0
print(len(t) - Max)

Solution (Python):
S = input()
T= input()
ans=0
if T in S:
  ans=0
  
S=list(S)
T=list(T)


S_pattern=[]
pre=0
lat=len(T)
while True:
  S_pattern.append(list(S[pre:lat]))
  pre+=1
  lat+=1
  if lat==len(S)+1:
    break

scores=[]
for i in S_pattern:
  score=0
  for k in range(len(i)):
    if T[k] != i[k]:
      i[k] = T[k]
      score+=1
  scores.append(score)
  
print(min(scores))

Solution (Python):
S = input()
T = input()
 
min = len(T)
for t in range(len(S) - len(T)+1):
    tmp = 0
    for i in range(len(T)):
        if S[i+t] != T[i]:
            tmp+=1
    
    if tmp < min:
        min = tmp
 
print(min)

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

from collections import deque

if T in S:
    print(0)

else:
    n = len(S) - len(T)
    lst = []
    for x in range(n + 1):
        s = S[x:(len(T) + x)]
        ds = deque(s)
        dt = deque(T)
        count = 0
        while ds:
            if ds.popleft() == dt.popleft():
                count += 1
        lst.append(count)
    print(len(T) - max(lst))

Solution (Python):

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

diff = len(S) - len(T)

mins = []
for i in range(diff+1):
    s = S[i:i+len(T)]
    c = 0
    
    for ss, tt in zip(s, T):
        if(ss != tt):
            c += 1
    mins.append(c)     

print(min(mins))

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

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

min_diff=len(T)
for i in range(len(S)-len(T)+1):
    diff=len(T)
    for j in range(len(T)):
        if T[j]==S[i+j]:
            diff -= 1
    if diff<min_diff:
        min_diff = diff
ans = min_diff
print(ans)

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

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

count = len(t)

for i in range(0, len(s) - len(t) + 1):
    x = s[i : i + len(t)]
    cnt = 0
    for i in range(len(t)):
        if t[i] != x[i]:
            cnt += 1
    if count >= cnt:
        count = cnt

print(count)

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

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

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

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

count = 0
SA = []
ans = [0]

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

print(len(T) - max(ans))

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

ns = len(list(S))
nt = len(list(T))

node = [0] * (ns-nt+1)

for i in range(ns-nt+1):
    for j in range(nt):
        if S[i+j] == T[j]:
            node[i] += 1


print(nt - max(node))

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

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

    return ans

lt = len(t)
ans = len(s)
for i in range(len(s)-lt+1):
    part = (s[i:i+lt])
    tmp_ans = count_mismatch(part, t)
    ans = min(ans, tmp_ans)

print(ans)

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

    min_v = len(t)
    
    for i in range(len(s)-len(t)+1):
        cnt = 0
        for x, y in zip(s[i:i+len(t)], t): 
            if not(x == y):
                cnt += 1
            
        if min_v > cnt:
            min_v = cnt

    print(min_v)
        
if __name__ == '__main__':
    main()

Solution (Python):
def main():
    S = str(input())
    T = str(input())
    counter = 0
    max_match = 0

    if T in S:
        print(0)
    else:
        for i in range(len(T), len(S)+1):
            counter = 0
            for j in range(len(T)):
                if S[i-len(T)+j] == T[j]:
                    counter += 1
            if max_match < counter:
                max_match = counter
        print(len(T)-max_match)
main()

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

c1 = len(s)
c2 = len(t)
max_count = 0
if c1 != c2:
  for i in range(c1 - c2):
    count = 0
    for j in range(c2):
      if s[i + j] == t[j]:
        count += 1
    if count > max_count:
      max_count = count
else:
  for i in range(c1):
    if s[i] == t[i]:
      max_count += 1
print(c2-max_count)

Solution (Python):
s = input()
t = input()
count_list = []
count = 0

for i in range(len(s) - len(t) + 1):
    for j in range(len(t)):
        if s[i+j] == t[j]:
            count += 1
    count_list.append(len(t) - count)
    count = 0

print(min(count_list))

Solution (Python):
s = input()
t = input()
res = []
for i in range(len(s)-len(t)+1):
    x = s[i:i+len(t)]
    count = sum(1 for a, b in zip(t, x) if a != b)
    res.append(count)
print(min(res))

Solution (Python):
xmoji=input()
ymoji=input()

x=len(xmoji)
y=len(ymoji)
tempmin = 0
for i in range(0,x-y+1):
    xmin=xmoji[i:i+y]
    samenum=0
    for j in range(0,y):
        if(xmin[j]==ymoji[j]):
            samenum+=1
    if(tempmin<samenum):
        tempmin = samenum
print(y-tempmin)

Solution (Python):
S = input()
T = input()
ans = float("inf")
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 < ans:
    ans = x
print(ans)

Solution (Python):
ss = str(input())
tt = str(input())

maxmatch = 0

for i in range(len(ss)-len(tt)+1):
    nofmatch = 0
    for j in range(len(tt)):
        
        if ss[i+j] == tt[j]:
            nofmatch += 1
    if nofmatch > maxmatch:
        maxmatch = nofmatch

print(len(tt)-maxmatch)

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

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

ans = 0
for i in range(len(s)):
    x = check(s[i:i + len(t)], t)
    if ans  < x:
        ans = x

print(len(t) - ans)

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

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

print(len(t)-ans)

Solution (Python):




s = input()
t = input()



max_cnt = 0
for i in range(len(s) - len(t) + 1):
    _s = s[i:i + len(t)]

    cnt = 0
    for j in range(len(t)):
        if _s[j] == t[j]:
            cnt += 1

    

    if max_cnt < cnt:
        max_cnt = cnt

print(len(t) - max_cnt)

Solution (Python):


S = input()
T = input()

S_len = len(S)
T_len = len(T)
diff_len = S_len - T_len
tmp_count = 0
mached = 100000

for i in range(diff_len + 1):
    for j in range(T_len):
        if T[j] != S[j + i]:
            tmp_count = tmp_count + 1
    if tmp_count < mached:
        mached = tmp_count
    tmp_count = 0

print(mached)

Solution (Python):
N = input()
S = input()
a = 0
nums = list(N[i:i+len(S)] for i in range(len(N)) if i+len(S)-1 < len(N))
nums_max  = 0
for i in nums:
  tmp = 0
  for j in range(len(S)):
    if i[j] == S[j]:
      tmp += 1
  if nums_max < tmp:
    nums_max = tmp
print(len(S)-nums_max)

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

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

Solution (Python):

 
import sys
import math

s = input()
t = input()

dist_list = []

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

    
    dist = 0
    for j in range(len(t)):
        if sd[j] != t[j]:
            dist += 1
    
    dist_list.append(dist)

print(min(dist_list))

Solution (Python):
def compare(ar1,ar2):
    count = 0
    for i in range(len(ar1)):
        if ar1[i] != ar2[i]:
            count+=1
    return count

s = input()
t = input()
lowest = len(t)
for i in range(len(s)-len(t)+1):
    res = compare(t,s[i:i+len(t)])
    if res < lowest:
        lowest = res
print(lowest)

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

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

print(ans)

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

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

l_s = len(s)
l_t = len(t)

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

Solution (Python):



s = input()
t = input()

result = len(t)

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


    if result > dif:
        result = dif

print(result)

Solution (Python):
s = input()
t = input()
s_len = len(s)
t_len = len(t)

max_c = 0
if t in s:
    print(0)
    exit()
for i in range(s_len - t_len + 1):
    count = 0
    for j in range(t_len):
        if s[i+j] == t[j]:
            count+=1
    if count > max_c:
        max_c = count
print(t_len-max_c)

Solution (Python):
S=list(input())
T=list(input())
count=0
hako=[]
for i in range(len(S)-len(T)+1):
  for k in range(len(T)):
    if S[i+k]!=T[k]:
      count+=1
  hako.append(count)
  count=0
fin=min(hako)
print(fin)

Solution (Python):
S = input()
T = input()
ans = 10 ** 9

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()
new = list(S)
main = list(T)

thelist = []

for i in range(len(new)):
    if len(new[i:i+len(main)]) < len(main):
        break
    thelist += [new[i:i+len(main)]]

counter = 0

for lists in thelist:
    second_counter = 0
    for i in range(len(main)):
        if main[i] != lists[i]:
            second_counter += 1
    if counter == 0:
        counter = second_counter
    elif second_counter < counter:
        counter = second_counter

print(counter)

Solution (Python):
s = str(input())
t = str(input())
result = 0
diff = len(s) - len(t) + 1
start = 0
end = len(t)
strimlist = []
diflist = []


for i in range(diff):
  strim = s[start:end]
  strimlist.append(strim)
  start += 1
  end += 1

for j in strimlist:
  index = 0
  difresult = 0
  for k in range(len(t)):
    if j[index] == t[index]:
      index += 1
    else:
      difresult += 1
      index += 1
  diflist.append(difresult)
  diflist.sort()
print(diflist[0])

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

s=input().strip()
t=input().strip()
n=len(s)
m=len(t)
M=[]
for i in range(n-m+1):
    count=0
    for j in range(m):
        if s[i+j]==t[j]:
            count+=1
    M.append(m-count)
print(min(M))

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

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