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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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


if __name__ == "__main__":
    main()

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

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

LS = len(S)
LT = len(T)

Eqnum = 0
for i in range(LS - LT + 1):
    cnt = 0
    for j in range(LT):
        if T[j] == S[i+j]:
            cnt += 1
    if cnt > Eqnum:
        Eqnum = cnt

print(LT - Eqnum)

Solution (Python):

s = input()
t = input()

co = 0
num = 0
N = 0
N_max = 0
for i in range(len(s)-len(t)+1):
    for k in range(len(t)):
        if s[i+k] == t[k]:
            N += 1
    N_max = max(N,N_max)
    N = 0
print(len(t)-N_max)

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

Solution (Python):
s=input()
t=input()
ans=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
    ans=min(ans,dif)
print(ans)

Solution (Python):
def resolve():
    S = input()
    T = input()
    Min = 1000
    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
        Min = min(Min, C)
    print(Min)
    
resolve()

Solution (Python):
S=input()
T=input()
ans=10**5
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
  ans=min(ans,len(T)-a)
print(ans)

Solution (Python):
import copy
import math
import time
import statistics
import math
import itertools
import bisect
import sys
from decimal import *
from collections import deque


def get_int():
    return int(input())

def get_string():
    return input()

def get_int_list():
    return [int(x) for x in input().split()]

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

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

def get_string_char_list():
    return list(str(input()))



sys.setrecursionlimit(10 ** 6)

def main():
    start = time.time()

    s = get_string()
    t = get_string()

    ans = 10**5
    for i in range(len(s)-len(t)+1):
        wk = 0
        for ii in range(len(t)):
            if s[i+ii] != t[ii]:
                wk += 1
        ans = min(ans, wk)
    print(ans)



    


if __name__ == '__main__':
    main()

Solution (Python):
s = list(map(str,input()))
t = list(map(str,input()))

ans = len(t)

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

print(ans)

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

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

print(ans)

Solution (Python):
import math

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

ans = len(T)

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

print(ans)

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

ans = len(s)

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

Solution (Python):
S=input()
T=input()
ans=10**5
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
  ans=min(ans,len(T)-a)
print(ans)

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

s_l = len(S)
t_l = len(T)

m =100*100

for i in range(s_l - t_l + 1):
  U = S[i:i + t_l]
  c = 0
  for j in range(t_l):
    if (U[j] != T[j]):
      c += 1
  m = min(c, m)

print(m)

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

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

print(len(t) - max_match)

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

num = 10**10

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

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

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

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

Solution (Python):
s = list(str(input()))
t = list(str(input()))
a = []
for i in range(len(s) - len(t) + 1):
    if i != 0:
        t.insert(0, 0)
    count = 0
    for k in range(len(s)):
        if k < len(t):
            if s[k] != t[k] and t[k] != 0:
                count += 1
    a.append(count)
print(min(a))

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

print(min)

Solution (Python):
def d(s, t): return sum(i != j for i, j in zip(s, t))

s, t = input(), input()
n, m = len(s), len(t)
print(min(d(s[i:i + m], t) for i in range(n - m + 1)))

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


s, t = input(), input()
n = len(s)
m = len(t)
ans = 1000000
print(min(d(s[i:i + m], t) for i in range(n - m + 1)))

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

ans = len(t)

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

print(ans)

Solution (Python):
s = list(input())
t = list(input())
ans = 10**10
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()
sn = len(s)
t = input()
tn = len(t)
ans = 10000
for i in range(sn-tn+1):
    cou = 0
    for j in range(tn):
        if s[i+j] != t[j]:
            cou += 1
    ans = min(ans,cou)
print(ans)

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

st = [0] * (len(S) - len(T) + 1)

for i in range(len(S) - len(T) + 1):
  for j,t in enumerate(T):
    st[i] += S[i+j] == t

print(len(T) - max(st))

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

ans = 1001

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

print(ans)

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

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

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

print(ans)

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

lS = len(S)
lT = len(T)
q = 0

for i in range(0,lS-lT+1):
    p = 0
    for j in range(0, lT):
        if S[i+j] == T[j]:
            p += 1
    q = max(q, p)
ans = lT-q
print(ans)

Solution (Python):

from collections import defaultdict 
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 = math.inf 
for i in range(len(s)-len(t)+1):
    cnt = 0
    for j in range(len(t)):
        if t[j] != s[i+j]:
            cnt+=1
    ans = min(cnt,ans)
print(ans)

Solution (Python):
s=input()
t=input()
b=list()
for x in range(len(s)-len(t)+1):
    a=0
    for y in range(len(t)):
        
        if s[x+y]==t[y]:
            a+=1
    b.append(a)
print(len(t)-max(b))

Solution (Python):
S = input()
T = input()
ns = len(S)
nt = len(T)
idx_start = 0
n_eq_max = 0
for i in range(ns-nt+1):
    n_eq = 0
    for j in range(nt):
        if T[j] == S[i+j]:
            n_eq += 1
    if n_eq_max < n_eq:
        n_eq_max = n_eq
        idx_start = i
print(nt-n_eq_max)

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

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

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

S = input()
T = input()

ans = 1e9
i = 0
while True:
    S2 = S[i:i+len(T)]
    if len(S2) != len(T):
        break
    i += 1

    tmp = 0
    for s, t in zip(S2, T):
        tmp += s != t
    ans = min(ans, tmp)

print(ans)

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

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

Solution (Python):
S=input();T=input()
N=len(S);NP=len(T);M=len(T)
for i in range(N-M+1):
  cnt=0
  for j in range(M):
    if T[j]==S[j+i]:cnt+=1
  if NP>M-cnt: NP=M-cnt
print(NP)

Solution (Python):
s = input()
t = input()
counts = []
for i in range(len(s)):
    count = 0
    if len(s[i:]) < len(t):
        break
    tmp = s[i:]
    for j in range(len(t)):
        if tmp[j] != t[j]:
            count += 1
    counts.append(count)

print(min(counts))

Solution (Python):
s=input()
a=len(s)
t=input()
b=len(t)
maxcnt=0
for i in range(a-b+1):
	count=0
	for j in range(b):
		s1=s[i+j]
		s2=t[j]
		if(s1==s2):
			count+=1
	if(maxcnt<count):
		maxcnt=count	
print(b-maxcnt)

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

li=[]

for i in range(0,len(s)-len(t)+1):
    li.append(s[i:i+len(t)])

maxi=0
for w in li:
    count=0
    for k in range(len(t)):
        if(w[k]==t[k]):
            count+=1
    maxi=max(maxi,count)
print(len(t)-maxi)

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

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

for n in range(len(S) - len(T)+1):
    cnt = 0
    for k in range(len(T)):
        if T[k] != S[k+n]:
            cnt += 1
    ans = min(ans,cnt)

print(ans)

Solution (Python):

s = input()
t = input()
ans = len(t)

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

print(ans)

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

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

Solution (Python):
S = str(input())
T = str(input())
length = len(T)
finish = len(S)-length+1
answer = 0
for i in range(finish):
    wordS = S[i:i+length]
    counter = 0
    for j in range(length):
        if wordS[j] == T[j]:
            counter += 1
    answer = max(answer,counter)
print(length-answer)

Solution (Python):
S = input()
T = input()
ans = len(T)
for num1 in range(len(S)-len(T)+1):
  temp = len(T)
  for num2 in range(len(T)):
    if S[num1+num2] == T[num2]:
      temp -= 1
  if temp < ans:
    ans = temp
print(ans)

Solution (Python):
def main():
    S = input()
    T = input()
    N = len(S)
    M = len(T)
    ans = 1000
    for i in range(N-M+1):
        cnt = 0
        for j in range(M):
            if S[i+j] != T[j]:
                cnt += 1
        if cnt < ans:
            ans = cnt
    print(ans)
if __name__ == '__main__':
    main()

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


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

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

Solution (Python):
import difflib

s = input()
t = input()

ans= len(t)

if t in s:
    print(0)
    exit()

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

    ans = min(ans, diff)

print(ans)

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

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

num_list = []

for i in range(len(S)-len(T)+1):
    num = len(T)
    for j, target in enumerate(S[i:i+len(T)]):
        if target == T[j]:
            num -= 1
    num_list.append(num)
print(min(num_list))

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

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

ans = len(T)

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

print(ans)

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

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

max_ = 0
for i in range(0,(len(S)-len(T))+1):
    max_= max( count(S[i:len(T)+i],T) ,max_ )

print( len(T) - max_ )

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

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

Solution (Python):
s = input()
t = input()
n, m = len(s), len(t)

ans = 0
for i in range(n):
    if n < i+m:
        break
    x = s[i:i+m]
    cnt = 0
    for a, b in zip(x, t):
        if a == b:
            cnt += 1
    if ans < cnt:
        ans = cnt

print(m-ans)

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

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

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

answer = 0
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
  answer = max(answer, count)

print(str(t_len - answer))

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

Solution (Python):
s = input()
t = input()
n,m = len(s),len(t)

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

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

num_s = len(s)
num_t = len(t)
ans = len(t)




for i in range(num_s):
    end = i + num_t
    if (end > num_s):
        break
    tar_s = s[i:end]
    

    count = 0
    for a, b in zip(tar_s, t):
        if (a != b):
            
            count += 1

    ans = min(ans, count)


print(ans)

Solution (Python):
s = input()
t = input()
len_s = len(s)
len_t = len(t)
minimum = len_t

for i in range(len_s - len_t + 1):
  replace = 0
  for j in range(len_t):
    if s[i + j] != t[j]:
      replace += 1
  if replace < minimum:
    minimum = replace

print(minimum)

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

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

Solution (Python):





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


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

print(ans)

Solution (Python):
s = input()
t = input()
lt = len(t)
ls = len(s)
A = []
for i in range(ls-lt+1):
    cou = 0
    for j in range(lt):
        if s[i+j] == t[j]:
            cou += 1
    A.append(cou)
print(lt-max(A))

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

width = len(T)
predict_word = []
for s_index in range(len(S)):
    if(len(S) < s_index + width):
        break
    predict_word.append(S[s_index:s_index+width])


count_list, ans = [], []
for p_word in predict_word:
    tmp = []
    for count, word in enumerate(p_word):
        if(T[count] == word):
            tmp.append(word)
    count_list.append(tmp)

for count in count_list:
    ans.append(len(count))

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

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

ans = float("inf")
flag = False
for i in range(len(s)):
    curr = 0
    for j in range(len(t)):
        if i + j >= len(s):
            flag = True
            break
        if t[j] != s[i + j]:
            curr += 1
    if flag:
        break
    ans = min(ans, curr)
print(ans)

Solution (Python):
def matcher(s1,s2):
    match=0
    for i in range(len(s1)):
        if(s1[i]!=s2[i]):
            match+=1
            
    return match



s = input()
st = input()
mx=10**5

rangeforloop= len(s)+1 - len(st)
 
for i in range(rangeforloop):
    mx=min(mx,matcher(s[i:len(st)+i], st))
    
     
print(mx)

Solution (Python):
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

s=input()
t=input()

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

Solution (Python):
s=str(input())
t=str(input())
a=len(s)
b=len(t)
c=a-b
list=[]
for i in range(c+1):
  ans=0
  for j in range(b):
    if s[i+j]==t[j]:
      ans+=1
  list.append(ans)
  ans=0

print(b-max(list))

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

ans = 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

    ans = min(ans, diff)

print(ans)

Solution (Python):
a = input()
b = input()
mn = len(b)
for i in range((len(a) - len(b)) + 1):
    c = a[i:i+len(b)]
    count = 0
    for j in range(len(b)):
        if c[j] != b[j]:
            count += 1
    if mn > count:
        mn = count
print(mn)

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


if __name__ == "__main__":
    main()

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

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

print(ans)

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

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

mini = 10**9
for i in range(len(S)-len(T)+1):
    cnt = 0
    for ti in range(len(T)):
        cnt += 1 if S[i+ti] != T[ti] else 0
    mini = min(mini,cnt)
print(mini)

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

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

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

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

Solution (Python):
S = input()
T = input()
l = len(T)
min = l
max = 0
count = len(S) - l + 1
i = 0
while (i < count):
    c = 0
    for j in range(l):
        if S[i + j] == T[j]:
            c += 1
    if max < c:
        max = c
        min = l - max
    i += 1
print(min)

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

ans = len(T)

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

print(ans)

Solution (Python):
S = input()
T = input()
mic = len(T)
if T in S:
  print(0)
else:
  for i in range(len(S)-len(T)+1):
    counter = 0
    for l in range(len(T)):
      if T[l] != S[i+l]:
        counter+=1
    mic = min(mic,counter)
  print(mic)

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

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

Solution (Python):
s = input()
t = input()
ans = 10 ** 10
ls = len(s)
lt = len(t)
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):
a, b = input(), input()
res = len(b)
for i in range(len(a) - len(b) + 1):
  aa = a[i:len(b)+i]
  cnt = 0
  for x, y in zip(aa, b):
    if x != y:
      cnt += 1
  res = min(res, cnt)
print(res)

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

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

print(len(T) - max(counts))

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

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


def read():
    S = input().strip()
    T = input().strip()
    return S, T


def solve(S, T):
    mincost = 1000000
    for i in range(len(S)-len(T)+1):
        j = i + len(T)
        cost = 0
        for s, t in zip(S[i:j], T):
            if s != t:
                cost += 1
        mincost = min(mincost, cost)
    return mincost


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Solution (Python):

S = input()
T = input()

def count_diff(Sp):
    cnt = 0
    for i in range(len(Sp)):
        if T[i] != Sp[i]:
            cnt += 1
    return cnt

saved_cnt = len(T)

for i in range(len(S) - len(T) + 1):

    Sp = S[i:i+len(T)]
    
    cnt = count_diff(Sp)
    
    saved_cnt = min(saved_cnt, cnt)
        
print(saved_cnt)

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

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

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

Solution (Python):
s = input()
t = input()
n = len(s)
m = len(t)
ans = 1000

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

print(ans)

Solution (Python):
s = input()
n = input()
ans = 20000000
for i in range(len(s)):
  x = s[i:i+len(n)]
  con = 0
  if len(x) < len(n):
    break
  else:
    for y in range(len(n)):
      if x[y] != n[y]:
        con += 1
    ans = min(ans, con)
    
print(ans)

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

ans = 10 ** 9
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=input()
T=input()
ans=len(T)
for i in range(len(S)-len(T)+1):
    x=0
    for j in range(len(T)):
        if S[i:i+len(T)][j]==T[j]:
            x+=1
        ans=min(ans,len(T)-x)
print(ans)

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

answer = float('inf')
for s in range(len(S)):
    if len(S) - s < len(T):
        break
    count = 0
    for t in range(len(T)):

        if S[s+t] != T[t]:
            count += 1
            
    answer = min(answer, count)

print(answer)

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

ans=float('inf')
for i in range(0,ls-lt+1):
    ans=min(ans, sum([l!=m for l,m in zip(S[i:i+lt], T)]))
print(ans)

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

coincidence = 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
    coincidence = max(coincidence, count)

print(len(t) - coincidence)

Solution (Python):
import numpy as np

s = np.array([ord(x) for x in input()])
t = np.array([ord(x) for x in input()])

tlen = len(t)
res = tlen
for i in range(len(s)-tlen+1):
    tmp = s[i:i+tlen] - t
    c = tlen - list(tmp).count(0)
    res = min(res, c)
    if res == 0:
        break
print(res)

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

    return(len(T)-cnt)


print(main())

Solution (Python):
S = input()
T = input()
len_T = len(T)
d = len(S)-len_T
result = 10000
for i in range(d+1):
    if i == d:
        x = S[i:]
    else:
        x = S[i:-d+i]
    sum = 0
    for i in range(len_T):
        if T[i] == x[i]:
            sum += 1
    sum = len_T - sum
    if result > sum:
        result = sum
print(result)

Solution (Python):
S=str(input())
T=str(input())
n=len(S)
m=len(T)
ans=n

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

    ans = min(ans,count)

print(ans)

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

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

print(len(t) - cor)

Solution (Python):
def abc177_b():
    """
    シンプルに全探索でよい、ということだそうだよ。
    探索はsのほうに対して、インデックスをずらしながら何文字が一致するかを。
    """
    s = input()
    t = input()

    
    ans = len(t)

    for i in range(len(s) - len(t) + 1):
        cnt = 0
        
        for _s, _t in zip(s[i:], t):
            if _s != _t:
                cnt += 1

        ans = min(ans, cnt)

    print(ans)
   
if __name__ == '__main__':
    abc177_b()

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

tmp = []

for i in range(s - t + 1):
    tmp.append(S[i:i+t])

ans = 0
ansl = []

for i in range(len(tmp)):
    for j in range(t):
        if tmp[i][j] != T[j]:
            ans += 1
    ansl.append(ans)
    ans = 0

print(min(ansl))

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

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

print(len(t)-m)

Solution (Python):

s = str(input().strip())
t = str(input().strip())
cnt_min = 1001

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
    cnt = len(t) - cnt
    cnt_min = min(cnt, cnt_min)

print(cnt_min)

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

Solution (Python):
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

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

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

ans=10**10

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

print(ans)

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

    ans = min(ans, tmp)
print(ans)

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

min=len(t)
m=len(s)-len(t)
if m == 0:
    m = 1
for n in range(m):
    x=0
    for i in range(len(t)):
        if t[i] != s[n+i]:
            x=x+1

    if x<min:
        min = x
print(min)

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

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