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()
c =0
C = [0]
for i in range(len(S)):
  c = 0
  for j in range(len(T)):
    if S[i] == T[j] and i-j >= 0 and len(S)-i -1 >= len(T)-j -1:
      
      c = 1
      if not(i == len(S)-1 and j == len(T)-1):
        for k in range(len(T) - j-1):
          if S[i + k + 1] == T[j + k +1]:
            c += 1
        C.append(c)
        c = 0
      else:
        C.append(c)
print(len(T)-max(C))

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

    ans = len(t)
    for v in range(len(s) - len(t) + 1):
        a = [t[i] != x for i, x in enumerate(s[v:len(t)+v])]
        if sum(a) < ans:
            ans = sum(a)
    print(ans)


if __name__ == '__main__':
    Qb()

Solution (Python):

import random, string
S = input()
T = input()
l = len(T)
L = len(S)
max_ans = -1
for i in range(L):
   ans = 0
   if i + l > L:
      continue
   for j in range(l):
      if T[j] == S[i + j]:
            ans += 1
   max_ans = max(max_ans, ans)
print(l - max_ans)

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

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

print(ans)

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

stri = []
for i in range(len(s)-len(t)+1):
    j = i+ len(t)
    stri.append(s[i:j])
maxcount = 0
for i in range(len(stri)):
    count = 0
    for j in range(len(t)):
        if(stri[i][j] ==t[j]):
            count+= 1
    maxcount = max(maxcount,count) 
print(len(t)-maxcount)

Solution (Python):
import sys


def resolve(in_):
    S = next(in_).strip()
    T = next(in_).strip()

    ans = 0
    for i in range(len(S)):
        if len(S) - i < len(T):
            break
        v = 0
        for x, y in zip(S[i:], T):
            if x == y:
                v += 1
            ans = max(ans, v)
    
    return len(T) - ans
    

def main():
    answer = resolve(sys.stdin)
    print(answer)


if __name__ == '__main__':
    main()

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

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

Solution (Python):

import sys
sys.setrecursionlimit(1000000)
from collections import deque
import re

S=input()
T = input()

snum = len(S)
tnum = len(T)

m = tnum

for start in range(snum - tnum + 1):
    diff = 0
    for i in range(tnum):
        if S[start+i] != T[i]:
            diff += 1
    m = min(m, diff)

print(m)

Solution (Python):
s = input()
t = input()
L = len(s)
l = len(t)
p = L-l
li = []
for i in range(p+1):
    ns = s[i:i+l]
    num = 0
    for j in range(l):
        if ns[j]!=t[j]:
            num +=1
    li += [num]
print(min(li))

Solution (Python):
def core(s, t):
  result = len(t)
  for start in range(len(s) - len(t) + 1):
    diff = 0
    for i in range(len(t)):
      if t[i] != s[start + i]:
        diff += 1
    result = min([diff, result])
  
  return result
if __name__ == "__main__":
  strings = [input() for i in range(2)]
  print(core(strings[0], strings[1]))

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

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

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

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

Solution (Python):
s = input()
t = input()
ls = []
for i in range(len(s) - len(t) + 1):
    ls.append(s[i:i+len(t)])
now = 0
minimum = len(t)
for i in range(len(ls)):
    now = 0
    for j in range(len(t)):
        if t[j] == ls[i][j]:
            now += 1
    if len(t) - now < minimum:
        minimum = len(t) - now
print(minimum)

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

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

ans = lt
for i in range(ls - lt + 1):
    cnt = 0
    for es, et in zip(s[i:i+lt], t):
        cnt += es != et

    ans = min(ans, cnt)

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
S = input().strip()
T = input().strip()
score_list = []
for i in range(len(S) - len(T) + 1):
  s = S[i:i+len(T)]
  score = 0
  for i in range(len(s)):
    if s[i] != T[i]:
      score += 1
  score_list.append(score)
print(min(score_list))

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

ans = len(T) + 1
for i in range(len(S) - len(T) + 1):
    val = sum(1 for a, b in zip(S[i:i+len(T)], T) if a != b)
    ans = min(ans,  val)
print(ans)

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

Solution (Python):
import sys
def LS2(): return list(sys.stdin.readline().rstrip())  


S,T = LS2(),LS2()
a,b = len(S),len(T)

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

Solution (Python):
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    s = input()
    t = input()
    hoge = 10000
    let = len(t)
    les = len(s)
    ans = 10000
    for i in range(les-let+1):
        hoge = s[i:i+let]
        piyo = 0
        for j, k in zip(hoge,t):
            if j != k:
                piyo += 1
        if piyo < ans:
            ans = piyo
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
import sys
INF = 1 << 60
MOD = 10**9 + 7 
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    S = input()
    T = input()
    ans = INF
    for i in range(len(S) - len(T) + 1):
        ans = min(ans, sum(s != t for s, t in zip(S[i : i + len(T)], T)))
    print(ans)
resolve()

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

n = len(s)
nt = len(t)

ans = 1000
for i in range(n - nt + 1):
    string = s[i:i + nt]

    count = 0
    for c1, c2 in zip(string, t):
        if c1!=c2: count += 1
    
    ans = min(ans, count)

print(ans)

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

def main():
    s = list( input() )
    t = list( input() )
    s.pop(-1)
    t.pop(-1)
    len_s = len( s )
    len_t = len( t )
    max = 0
    for i in range( len_s - len_t + 1 ):
        same = 0

        for j in range(len_t ):
            if s[ i + j ] == t[ j ]:
                same += 1

        if same > max:
            max = same
    
    print( len_t - max )

main()

Solution (Python):
S = input()
T = input()
Sn = len(S)
Tn = len(T)
ans = 0

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

print(Tn - ans)

Solution (Python):
n = input()
m = input()
lst = []
if m in n:
    print(0)
else:
    for i in range(len(n) - len(m) + 1):
        count = 0
        for j in range(i, len(m) + i):
            if n[j] != m[j-i]:
                count += 1
        lst.append(count)
    print(min(lst))

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

print(ans)

Solution (Python):
import numpy as np
S = np.array(list(input().rstrip()))
T = np.array(list(input().rstrip()))

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

max_count = 0

for i in range(s-t+1):
  max_count = max(max_count, (S[i:i+t]==T).sum())
      
print(len(T) - max_count)

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

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

ans = 10**10
for i in range(len_S - len_T+1):
    num = 0
    for j in range(len_T):
        if S[i+j] != T[j]:
            num+=1
    ans = min(ans, num)

print(ans)

Solution (Python):
S = input()
T = input()
len_S = len(S)
len_T = len(T)
N = len_S-len_T+1
max_cnt = 0
for i in range(N):
    cnt = 0
    for j in range(len_T):
        if S[i+j]==T[j]:
            cnt+=1
        if j==len_T-1:
            if max_cnt<cnt:
                max_cnt=cnt
print(len_T-max_cnt)

Solution (Python):
import sys

def minChange(S2, S1):
   
    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 

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

Solution (Python):
S = str(input())
T = str(input())
dif = len(S) - len(T) + 1
lis = []

for i in range(dif):
  ng = 0
  S_new = S[i:i+len(T)]
  for j in range(len(T)):
    if S_new[j] != T[j]:
      ng += 1
  lis.append(ng)
print(min(lis))

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

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

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

print(len(T)-tmp)

Solution (Python):
S = str(input())
T = str(input())
m = 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
    m = min(m, x)

print(m)

Solution (Python):









import os
import sys




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



    ans = 0
    for i in range(len(S)-len(T)+1):
        stack = 0
        ans_tmp = 0
        for t in T:
            if t == S[i+stack]:
                ans_tmp += 1
            if ans_tmp > ans:
                ans = ans_tmp
            stack += 1
    print(len(T)-ans)


if __name__ == "__main__":
    main()

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

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

sone = ''

small = 0

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

print(small)

Solution (Python):
def count(A,B):
    counter=0
    for i in range(len(A)):
        if A[i]==B[i]:
            counter+=1
    return len(A)-counter
 
S = input()
T = input()
t = len(T)
s = len(S)
_min = float('inf')
for i in range(s-t+1):
    _min = min(_min,count(S[i:i+t],T))
print(_min)

Solution (Python):
def resolve():
    all_string = input()
    target_string = input()
    all_length = len(all_string)
    target_length = len(target_string)
    max_count = 0
    for i in range(all_length - target_length + 1):
        count = 0
        part_string = all_string[i:i+target_length]
        for s1, s2 in zip(part_string, target_string):
            if s1 == s2:
                count +=1
        if count>max_count:
            max_count = count
    print(target_length - max_count)

resolve()

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

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

Solution (Python):



S=input()
T=input()

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

m=0

for i in range (Slen-Tlen+1):
    temp=0
    for j in range (Tlen):
        if T[j]==S[i+j]:
            temp+=1
        else:
            continue
    else:
        if temp>m:
            m=temp
print(Tlen-m)

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

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()
a=set() ; b=[]
c=0
for i in input():
    a.add((i,c))
    c+=1
c=0
for i in input():
    b.append([i,c])
    c+=1
ans=0 ; cur=0
for num in range(len(a)-len(b)+1):
    cur=0
    for i in b:
        need=tuple([i[0],i[1]+num])
        if need in a:
            cur+=1
        ans=max(ans,cur)
print(len(b)-ans)

Solution (Python):
S = input()
T = input()
if T in S:
  print(0)
else:
  biggest_match = 0
  start = 0
  for i in range(len(S)-len(T)+1):
    j = 0
    match = 0
    for t in T:
      if t == S[i+j]:
        match += 1
      j += 1
    if match > biggest_match:
      biggest_match = match
      start = i
  print(len(T) - biggest_match)

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

    tmp_S = S

    num = 0

    for k in range(len(S) - len(T) + 1):
        tmp_n = 0
        for i in range(len(T)):
            if tmp_S[i] == T[i]:
                tmp_n += 1
        
        if num <= tmp_n:
            num = tmp_n
        del tmp_S[0]

    ans = len(T) - num

    print(ans)

if __name__ == "__main__":
    solve()

Solution (Python):
S = input()
T = input()
cnt_list = []

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

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

N = len(S)
M = len(T)
l = []
for i in range(N+1):
  sim = 0
  if len(S[i:i+M]) != M: break
  for j in range(M):
    if S[i:i+M][j] == T[j]:
      sim += 1
  dis = M - sim
  l.append(dis)
  
print(min(l))

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



n = len(s)
k = len(t)


maxn = 0
if s==t:
    maxn=k
for i in range(n-k+1):
    
    neq = 0
    for c1, c2 in zip(s[i:i+k], t):
        neq += int(c1==c2)
    
    if neq > maxn:
        maxn=neq
        
print(k-maxn)

Solution (Python):
def main():

    
    m_cnt_tmp = 0
    m_cnt_ans = 0

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

    
    for s_cnt in range(0, s_len - t_len + 1):
        for t_cnt in range(0, t_len):
            if (t[t_cnt] == s[s_cnt + t_cnt]):
                m_cnt_tmp += 1
        if (m_cnt_ans < m_cnt_tmp):
            m_cnt_ans = m_cnt_tmp
        m_cnt_tmp = 0

    
    print(t_len - m_cnt_ans)


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
T = input()
count = len(T)
tmp = 0
j = 0
i = len(S) - len(T)

while(i >= 0):
    
    
    for k in range(len(T)):
        if S[i+k] == T[k]:
            
            j += 1
        else:
            
            tmp = len(T) - j
            
            if count > tmp:
                count = tmp
            tmp = len(T)
    if len(T) == j:
        count = 0
    i -= 1
    j = 0

print(count)

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

len_s, len_t = len(S), len(T)
l = []
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
    l.append(tmp)
print(min(l))

Solution (Python):
a = input()
b = input()
count = [0]*(len(a)-len(b)+1)

for i in range(len(a)-len(b)+1):
    for j in range(len(b)):
        if a[i+j] != b[j]:
            count[i] += 1
print(min(count))

Solution (Python):
s = list(input())
t = list(input())
cnt = len(t)
diff = cnt

for i in range(len(s)):
    for j in range(len(t)):
        if len(s) <= i+j:
            cnt = len(t)
            break
        elif s[i+j] == t[j]:
            cnt -= 1
    if cnt < diff:
        diff = cnt
    cnt = len(t)
print(diff)

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

s = len(S)
t = len(T)
"""
if T in S:
     print(0)
     """

m = s - t + 1
bag = []
for i in range(m):
     
     num2 = t
     for j in range(t):
          
          
          if S[i+j] == T[j]:
               num2 -= 1
     
     bag.append(num2)

list.sort(bag)
print(bag[0])

Solution (Python):
s1=input()
s2=input()
ans=0
for i in range(len(s1)-len(s2)+1):
    c=0
    j=0
    while j<len(s2):
        if s1[i+j]==s2[j]:
            c+=1
        j+=1
    ans=max(ans,c)
print(len(s2)-ans)

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

Solution (Python):
import bisect,collections,copy,itertools,math,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())
def main():
    s = S()
    t = S()
    s = list(s)
    t = list(t)
    slen = len(s)
    tlen = len(t)
    ans = float("inf")

    for i in range(tlen):
        char = t[i]
        for j in range(i,slen-(tlen-i-1)):
            aaa = s[j]
            if aaa==char:
                rng = s[j:j+tlen-i]
                ex = t[i:]
                cnt = 0
                for x,y in zip(rng,ex):
                    if x == y:
                        cnt += 1
                ans = min(ans, tlen-cnt)
    if ans == float("inf"):
        ans = tlen
    print(ans)

main()

Solution (Python):
s=input()
t=input()
sl=len(s)
tl=len(t)
kotae=tl
for i in range(0,sl-tl+1):
  x=s[i:i+tl]
  b=0
  for j in range(tl):
    if x[j]!=t[j]:
      b+=1
  if b<kotae:
    kotae=b
print(kotae)

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

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

Solution (Python):
def f(l,s):
	c=0
	for i in range(len(l)):
		if l[i]==s[i]:
			c+=1
	return len(l)-c

t=input()
sub=input()
n=len(t)
m=len(sub)
c=m
for i in range(0,n-m):
	c=min(c,f(t[i:i+m],sub))
if n==m:
	c=f(sub,t)
print(c)

Solution (Python):
from __future__ import division, print_function






from sys import stdin, stdout
import bisect            
import math
import heapq
i_m=9223372036854775807
def inin():
    return int(input())
def stin():
    return input()
def spin():
    return map(int,stin().split())
def lin():                           
    return list(map(int,stin().split()))
def matrix(n):
    
    return [list(map(int,input().split()))for i in range(n)]


def string2intlist(s):
    return list(map(int, s))

def calculate_sum(a, N): 
    
    m = N / a 
    
    sum = m * (m + 1) / 2
    
    ans = a * sum
    return ans
def series(N):
    return (N*(N+1))//2

def count2Dmatrix(i,list):
    return sum(c.count(i) for c in list)

def modinv(n,p):
    return pow(n,p-2,p)

def GCD(x, y): 
    x=abs(x)
    y=abs(y)
    if(min(x,y)==0):
        return max(x,y)
    while(y): 
        x, y = y, x % y 
    return x
def LCM (x, y):
    return (x * y) // GCD(x, y)
    
def Divisors(n) : 
    l = []  
    for i in range(1, int(math.sqrt(n) + 1)) :
        if (n % i == 0) : 
            if (n // i == i) : 
                l.append(i) 
            else : 
                l.append(i)
                l.append(n//i)
    return l
def isprime(n):
    for i in range(2, int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True
prime=[]
def SieveOfEratosthenes(n): 
    global prime
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime[p] == True): 
            for i in range(p * p, n+1, p): 
                prime[i] = False
        p += 1
    f=[]
    for p in range(2, n): 
        if prime[p]: 
            f.append(p)
    return f
q=[]       
def dfs(n,d,v,c):
    global q
    v[n]=1
    x=d[n]
    q.append(n)
    j=c
    for i in x:
        if i not in v:
            f=dfs(i,d,v,c+1)
            j=max(j,f)
            
    return j

 
"""*******************************************************"""
s = stin()
t = stin()
c,d = 0,0
for i in range(len(s)-len(t)+1):
    d=0
    for j in range(len(t)):
        if s[i+j]==t[j]:
            d+=1
    
    c=max(d,c)
print(len(t)-c)

Solution (Python):
s=input()
t=input()
len_s=len(s)
len_t=len(t)
len_n=len_s-len_t
ans=100000
for i in range(0,len_n+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()
ls = len(s)
lt = len(t)

a = []
sum_ = 0
for i in range(ls-lt+1):
    ss = s[i:i+lt]
    sum_ = 0
    for i, alb in enumerate(t):
        if alb == ss[i]:
            sum_+= 1
    a.append(sum_)

print(lt - max(a))

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

print(ans)

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

Solution (Python):
S = str(input())
T = str(input())
import numpy as numpy
len_S = len(S)
len_T = len(T)
count = numpy.zeros(len_S-len_T+1)
for i in range(len_S-len_T+1):
  for j in range(len_T):
    if not S[i+j] == T[j]:
      count[i] +=1
print(int(min(count)))

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

s = len(S)
t = len(T)
u = s-t+1

A = []
for i in range(u):
  count = 0
  for j in range(t):
    if T[j] != S[i+j]:
      count += 1
  A.append(count)
print(min(A))

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

def same_chara(list1, list2):
  count = 0
  for a, b in zip(list1, list2):
    if a == b:
      count += 1
  return count

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

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

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

    if T in S:
        print(0)
        return
    if len(T) == len(S):
        count = 0
        for t, s in zip(S, T):
            if t != s:
                count += 1
        print(count)
        return

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


def main():
    probB()


if __name__ == '__main__':
    main()

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

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

ans = 1000
max_cnt = 0
for i in range(len_s - len_t + 1):
    cnt = 0
    l = []
    for j in range(len_t):
        if s[i : i + len_t][j] == t[j]:
            cnt += 1
        if s[i : i + len_t][j] != t[j]:
            cnt += 0
    max_cnt = max(max_cnt, cnt)

ans = min(ans, len_t - max_cnt)

print(ans)

Solution (Python):
import sys
s = str(input())
t = str(input())
ans = sys.maxsize 
for i in range(len(s) - len(t) + 1): 
        minRemovedChar = 0
        for j in range(len(t)): 
            if (t[j] != s[i + j]): 
                minRemovedChar += 1
        ans = min(minRemovedChar, ans) 
print(ans)

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

maiores = []
maior = 0

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


print(len(t) - max(maiores))

Solution (Python):
s = input()
t = input()
if t in s:
    print(0)
else:
    ans = len(t)
    for i in range(len(s) - len(t) + 1):
        cnt = 0
        k = i
        l = 0
        while l < len(t) and k < len(s):
            if s[k] != t[l]:
                cnt += 1 
            k += 1
            l += 1    
        ans = min(ans, cnt)
    print(ans)

Solution (Python):
s=input()
t=input()
len_s=len(s)
len_t=len(t)
len_n=len_s-len_t
ans=100000
for i in range(0,len_n+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):
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 = list(input())
t = list(input())

r = len(s) - len(t)
l = []
if r != 0:
    for start in range(r):
        count = 0
        for i in range(len(t)):
            if t[i] == s[start+i]:
                count +=1
        l.append(count)
    ans = len(t)- max(l)
else:
    count = 0
    for i in range(len(t)):
        if t[i] == s[i]:
            count +=1
    ans = len(t)- count   

print(ans)

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

ans = 0
cnt = 0

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


print(len(T) - ans)

Solution (Python):



S = input()
T = input()

SL = len(S)
TL = len(T)
X = SL - TL + 1
min = SL
for i in range(X):
    dif = 0
    for j in range(TL):
        if S[i+j] != T[j]:
            dif += 1
    if dif < min:
        min = dif
    
print(min)

Solution (Python):
s = input()
t = input()
l = len(t)
ls = len(s)
ans = 0

for i in range(ls-l+1):
    num = 0
    for j in range(l):
        if s[i+j]==t[j]:
            num += 1
    ans = max(ans, num)

print(l-ans)

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

min_ch = 9999999
for i in range(0, len(S) - len(T) + 1):
    s = S[i:i+len(T)]
    ch = 0
    for j in range(len(T)):
        if T[j] != s[j]:
            ch += 1

    if ch < min_ch:
        min_ch = ch

print(min_ch)

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















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

max_value = 0
for i in range(0, len(S)-len(T)+1):
  t = similar(S[i:len(T)+i], T)
  
  if t > max_value:
    max_value = t
print(len(T)-max_value)

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

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

count_min=1000 

for ind_s in range(0,len(S)-len(T)+1): 
    count=0 

    for ind_t in range(0,len(T)): 
        count+=int(S[ind_s+ind_t]!=T[ind_t]) 

    if count<count_min: 
        count_min=count 

print(count_min)

Solution (Python):
import re

s=input()
t=input()

count=0
ans=100000
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
    if (len(t)-count) < ans:
        ans=(len(t)-count)

print(ans)

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

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

a = len(s)
b = len(t)
c = a-b;
min1 = 0;
min2 = 0;
for i in range(c+1):
  for j in range(b):
    
    if s[j+i]==t[j]:
      
      min2 += 1
  if min1<min2:
    min1 = min2
  min2 =0
print(b-min1)

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

Solution (Python):








s = input()
t = input()
ans = 0

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

    if ans < num:
        ans = num

print(len(t) - ans)

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

Min = 100000

for i in range(len(S) - len(T) + 1):
    count = 0
    for n in range(len(T)):
        if S[i + n] != T[n]:
            count += 1
    if count < Min:
        Min = count

print(Min)

Solution (Python):
S=list(map(str,input()))
T=list(map(str,input()))
X=[]
Z=0
for I in range(len(S)-len(T)+1):
    Y=S[I:I+len(T)]
    Z=0
    for J in range(len(T)):
        if Y[J]==T[J]:
            Z=Z+1
    X.append(Z)
if not X==[]:
    print(len(T)-max(X))
elif S==T:
    print(0)
else:
    print(len(T))

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

max = 0

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

Solution (Python):
S = input()
T = input()
LS = len(S)
LT = len(T)
L = []

if T in S:
  print(0)
else:
    for ls in range(LS - LT + 1):
        d = 0
        for lt in range(LT):
            if S[ls + lt] != T[lt]:
                d += 1
        L.append(d)
    print(min(L))

Solution (Python):
S=str(input())
T=str(input())
t=1000
Slen=1000
Tlen=1000
for i in range(1000):
  try:
    k=S[i]
  except IndexError:
    Slen=i
    break
for j in range(1000):
  try:
    k=T[j]
  except IndexError:
    Tlen=j
    break

for i in range(Slen-Tlen+1):
  s=0
  for j in range(Tlen):
    if S[i+j]==T[j]:
      s+=1
    else:
      continue
  t=min(t,Tlen-s)
print (t)

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

c = []
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
    c.append(count)
print(len(t) - max(c))

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

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

mincount=len(T)

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

print(mincount)