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


from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys

INF = float('inf')


def solve(S: str, T: str):
    return len(T) - max(sum(s == t for s, t in zip(S[i:], T)) for i in range(len(S) - len(T) + 1))


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  
    T = next(tokens)  
    print(f'{solve(S, T)}')


if __name__ == '__main__':
    main()

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

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

Solution (Python):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines

def main():
    s = tuple(input())
    t = tuple(input())
    s_len = len(s)
    t_len = len(t)
    r = s_len
    for i1 in range(s_len - t_len + 1):
        s2 = s[i1:i1 + t_len + 1]
        tmp0 = sum([se != te for se, te in zip(s2, t)])
        r = min(r, tmp0)
    print(r)

if __name__ == '__main__':
    main()

Solution (Python):
s = input("")
t = input("")
k = 0

if len(s) == len(t):
    s += "?"

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

print(len(t)-k)

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

ans = 10000

for i in range(len(s)-len(t)+1):
    cnt = 0
    S = s[i:i+len(t)]
    for j in range(len(t)):
        if S[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):
    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 = input()
t = input()
l = []
for i in range(len(s)-len(t)+1):
  cha = 0
  for j in range(len(t)):
    if s[j+i] == t[j]:
      cha += 1
  l.append(cha)
print(len(t)-max(l))

Solution (Python):
import sys
from collections import deque

import math

def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

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

if __name__=='__main__':
    s = S()
    t = S()
    solve()

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

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

print(ans)

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

s = len(S)
t = len(T)
m = 10 ** 4

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

Solution (Python):
S = input()
T = input()
counts = []
for i in range(len(S) - len(T)+1):
  count = len([s for s,t in zip(S[i:],T) if s != t])
  counts.append(count)
print(min(counts))

Solution (Python):
def substring(s, t):
    min = 10000    
    startIdx = 0   
    arrayIdx = 0   
    arrayS = []
    arrayT = []
    
    for item in s:
        arrayS.append(item)

    
    loopCnt = len(s) - len(t) + 1
    for i in range(0, loopCnt):
        count = 0       

        arrayIdx = startIdx

        for item in t:
            if not item == arrayS[arrayIdx]:
                count += 1
            arrayIdx += 1

        if count < min:
            min = count
        
        startIdx += 1

    print(min)


        

s = input()
t = input()

substring(s, t)

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

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

    if counter < min_length:
        min_length = counter
print(min_length)

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

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

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

print(len(t)- res)

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

l = len(t)
n = len(s) - len(t)

def count_diffs(lhs, rhs):
    return len(list(filter(lambda t: t[0] != t[1], zip(lhs, rhs))))

min_diff = l

for i in range(n):
    diff = count_diffs(s[i : i + l], t)

    if diff < min_diff:
        min_diff = diff

if n != 0:
    print(min_diff)

else:
    print(count_diffs(s, t))

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

Solution (Python):
match_cnt = 0

S = input()
T = input()

S_len = len(S)
T_len = len(T)

for S_idx in range(S_len - T_len + 1):
  cnt = 0

  for T_idx in range(T_len):
    if(S[S_idx + T_idx] == T[T_idx]):
      cnt += 1
  
  if( cnt > match_cnt ):
    match_cnt = cnt

print(T_len - match_cnt)

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

def count_diff(s, t):
    N = 0
    for i, j in zip(s, t):
        if i != j:
            N += 1
    return N


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

res = nt
for i in range(ns - nt + 1):
    sub = S[i:i+nt]
    a = count_diff(sub, T)
    if a < res:
        res = a

print(res)

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

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

print(len(t)-res)

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

Solution (Python):
def solve(word1, word2):
	n1, n2 = len(word1), len(word2)
	res = []
	
	for i in range(n1 - n2 + 1):
		cur_s = word1[i : i + n2]
		res.append(sum(cur_s[j] != word2[j] for j in range(len(cur_s))))
	
	return min(res)
  
s = input()
p = input()
print(solve(s, p))

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

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

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

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

ans = len(s)

for i in range(len(s) - len(t) + 1):
    sub = s[i:i+len(t)]
    ans = min(ans, len(t) - sum(a == b for a, b in zip(sub, t)))

print(ans)

Solution (Python):
s = input()
t = input()
maxs = 0
if len(s) == len(t):
    c = 0
    for k in range(len(t)):
        if s[k] == t[k]: c += 1
    print(len(t) - c)
    quit()
for i in range(len(s)-len(t)):
    c = 0
    for k in range(len(t)):
        if s[i+k] == t[k]: c += 1
    maxs = max(c,maxs)
print(len(t) - maxs)

Solution (Python):

def main():
    s = input()
    t = input()
    min = int(1e9)
    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
    print(min)
            
if __name__ == "__main__":
    main()

Solution (Python):

s = str(input())
t = str(input())



k = len(t)
li = []
for i in range(len(s) - len(t) + 1):
    
    tmp = k
    for l in range( k ):
        if t[l] == s[i+l]:
            tmp -= 1
    li.append(tmp)
print(min(li))

Solution (Python):

def main():
    s = input()
    t = input()
    ans = 1000

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

        ans = min(ans, m)

    print(ans)


if __name__ == '__main__':
    main()

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

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

ANS = len(T) - m

print(ANS)

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

a = []

for i in range(len(s) - len(t) + 1):
    w = s[i:i + len(t)]
    sum = 0
    for j in range(len(t)):
        if w[j] != t[j]:
            sum += 1
    a.append(sum)

print(min(a))

Solution (Python):

import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

S = input()
T = input()
lenS = len(S)
lenT = len(T)

difmin = float("inf")
for si in range(lenS - lenT + 1):
    dif = 0
    for s, t in zip(S[si:], T):
        if s != t:
            dif += 1
    difmin = min(difmin, dif)

print(difmin)

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

ans = []

for i in range(0, len(s) - len(t) + 1):
  score = 0
  
  u = s[i:i + len(t)]
  for j in range(len(t)):
    
    if u[j] != t[j]:
      score += 1
  ans.append(score)

print(min(ans))

Solution (Python):
s = input()
t = input()
change = len(t)
for x in range(len(s) - len(t) + 1):
    temp_change = 0
    for y in range(len(t)):
        if s[x+y] != t[y]:
            temp_change += 1
    if change > temp_change:
        change = temp_change
print(change)

Solution (Python):
                                                                                                                                                      
                                                                                                                                                       
                                                                                                                                                       
S=list(input())                                                                                                                                        
T=list(input())                                                                                                                                        
                                                                                                                                                       
T_size = len(T)                                                                                                                                        
                                                                                                                                                       
def match_num(x):                                                                                                                                      
    return T_size - sum([1 for a,t in zip(x, T) if a==t])                                                                                              
                                                                                                                                                       
b=[]                                                                                                                                                   
for i in range(len(S)-T_size+1):                                                                                                                       
    b.append(match_num(S[i:i+T_size]))                                                                                                                 
                                                                                                                                                       
print(min(b))

Solution (Python):
s, t = [input() for i in range(2)]
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
        if ans  > cnt:
                ans = cnt
print(ans)

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

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

result =0
index = 0
Min = len(T)

while True:
    sum = 0
    temp = S[index : index + len(T)]
    
    for i in range (len(T)):
        if temp[i] != T[i]:
            sum+=1
    
    Min = min(Min,sum)
    
    index +=1
    
    if index + len(T) >  len(S):
        break
    
print(Min)

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

ans = LT

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

print(ans)

Solution (Python):





















import math
import copy
import string



INF = int(10**18) 
pi = math.pi

MOD = 1000000007








def my_pow(N, a, M):
    if(a == 0):
        return 1
    else:
        if(a % 2 == 0):
            tempo = my_pow(N, a/2, M)
            return (tempo * tempo) % M
        else:
            tempo = my_pow(N, a - 1, M)
            return (tempo * N) % M





def my_combination(N, a, M):
    res = 1

    for i in range(0, a):
        res *= N - i
        res %= M

    for i in range(0, a):
        res *= my_pow(i + 1, M - 2, M)
        res %= M

    return res





def my_combination_table(N, M, v):
    if(len(v) < N + 1):
        l = N + 1 - len(v)
        tempo = [1] * l
        v.extend(tempo)

    for i in range(1, N + 1):
        v[i] = v[i - 1] * (N - (i - 1))
        v[i] %= M

        v[i] *= my_pow(i, M - 2, M)
        v[i] %= M

    return












S = input()
T = input()

NS = len(S)
NT = len(T)


res = NT
for i in range(0, NS - NT + 1):
    tempo = 0
    for j in range(0, NT):
            if S[i + j] != T[j]: tempo += 1   
    res = min(res, tempo)
print(res)

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

ans = len(t)

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

print(ans)

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

ans = len(S)

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,t=input(),input()
ans=len(t)
"""
s[x]から、t文字分探索。tと一致しない箇所があればtmpをプラス。
tmpの合計は直さなくてはいけない文字の数だから、tmpの各合計の中で最も小さい数が答え。
"""
for x in range(len(s)-len(t)+1):
    tmp=0
    for y in range(len(t)):
        if s[x+y]!=t[y]:
            tmp+=1
    ans=min(ans,tmp)        
print(ans)

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

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

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

Solution (Python):
S = input()
T = input()
Ns = len(S)
Nt = len(T)

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

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

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


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

Solution (Python):



def main():
    s = input()
    t = input()

    ans = float("inf")

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

    print(ans)


main()

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

ans = 10**9
for i in range(n,len(S)+1):
    dummy = S[i-n:i]
    tmp = 0
    for j in range(n):
        if dummy[j] != T[j]:
            tmp +=1

    if ans > tmp:
        ans = tmp
print(ans)

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

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

max_match = 0

n = len(T)
m = len(S)

for i in range(m-n+1):
    tmp = 0
    for j in range(i,i+n):
        if S[j] == T[j-i]:
            tmp += 1
    if tmp > max_match:
        max_match = tmp

ans = n - max_match



print(ans)

Solution (Python):
def solve(string):
    s, t = map(list, string.split())
    ans = min(
        sum(1 if s[i + j] != t[j] else 0
            for j, _ in enumerate(t))
        for i in range(len(s) - len(t) + 1))
    return str(ans)

    pass


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Solution (Python):
def solve(string):
    s, t = map(list, string.split())
    ans = len(t)
    for i in range(len(s)-len(t)+1):
        c = 0
        for j, _ in enumerate(t):
            c += 1 if s[i + j] != t[j] else 0
        ans = min(ans, c)
    return str(ans)

    pass


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Solution (Python):
string1 = input()
string2 = input()

n, m = len(string1), len(string2)
best = float("inf")
for i in range(n - m + 1):
  current = string1[i:i+m]
  differences = 0
  for i in range(m):
    if current[i] != string2[i]:
      differences += 1
  best = min(differences, best)

if best == float("inf"):
  print(0)
else:
  print(best)

Solution (Python):
from sys import stdin

input = stdin.readline

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

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

def cnt(a,b):
    return sum(1 for aa,bb in zip(a,b) if aa != bb)

res = nt
for i in range(ns - nt + 1):
    res = min(res,cnt(s[i:i+nt],t))

print(res)

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

ans = len(t)
for i in range(len(s) - len(t) + 1):
    tmp = s[i:i+len(t)]
    count = 0
    for t1, t2 in zip(tmp, t):
        if t1 != t2:
            count += 1
    ans = min(ans, count)
print(ans)

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

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

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

iteration = len(S) - len(T) + 1

if T in S:
    ans = 0
else:
    minimum = len(T)
    for i in range(iteration):

        s = S[i:len(T)+i]


        count = 0
        for j in range(len(T)):
            if s[j] != T[j]:
                count += 1

        minimum = min(minimum, count)
    ans = minimum
    
print(ans)

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

Solution (Python):
s = input()
t = input()
l = len(s)
m = len(t)
maxi = 0
for i in range(l-m+1):
    t1 = s[i:i+m]
    x = 0
    for j in range(m):
        if t1[j] == t[j]:
            x = x + 1
    if maxi < x:
        maxi = x

mini = m - maxi

print(mini)

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

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

res = len(T)

for i in range(len(S) - len(T) + 1):
    cnt = 0
    smallS = S[i:i+len(T)]
    for s, t in zip(smallS, T):
        if s == t:
            cnt += 1
    if (len(T) - cnt) < res:
        res = len(T) - cnt

print(res)

Solution (Python):
S = str(input())
T = str(input())
lens = len(S)
lent = len(T)
ans = []

for i in range(lens-lent + 1):
      count = 0
      U = S[i: i+lent]
      for j in range(lent):
            if U[j] != T[j]:
                count += 1
      ans.append(count)
print(min(ans))

Solution (Python):
S = str(input())
T = str(input())
s = len(S)
t = len(T)
ans = []
for i in range(s-t+1):
    count = 0
    U = S[i:i+t]
    for j in range(t):
        if U[j] != T[j]:
            count += 1
    ans.append(count)
print(min(ans))

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    S = input()
    T = input()

    

    N = len(S)
    M = len(T)
    L = N - M 
    
    ans = M
    for i in range(L+1): 
        
        cnt = M
        for j in range(M):
            if S[i+j] == T[j]: 
                cnt -= 1
        
        ans = min(ans, cnt)
    print(ans)
if __name__ == '__main__':
    main()

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

ans = 1000
sub = 0
flag = False
for i in range(len(s)):
    if s[i] != t[sub]:
        sub = 0
        continue
    else:
        if sub == len(t) - 1:
            print(0)
            flag = True
            break
        sub += 1

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

    print(ans)

Solution (Python):
def main():
    s = str(input())
    t = str(input())
    s_num = len(s)
    t_num = len(t)
    ans = []
    for i in range(s_num - t_num + 1):
        count = 0
        U = s[i:i + t_num]
        for j in range(t_num):
            if U[j] != t[j]:
                count += 1
        ans.append(count)
    print(min(ans))

main()

Solution (Python):
S = list(input())
T = list(input())
diff = len(S)-len(T)

count, best = 0, 0

for i in range(diff+1):
  
  s = S[i:]
  
  
  
  
  count = 0
  for j,k in zip(s,T):
    if j == k:
      count += 1
    if count > best:
      best = count

print(len(T)-best)

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):
s=input()
t=input()
lt=len(t);ls=len(s)
ans=lt
for i in range(ls-lt+1):
    cnt=0
    for j in range(len(t)):
        if s[i:i+lt][j]!=t[j]:
            cnt+=1
    ans=min(ans,cnt)
print(ans)

Solution (Python):
S = str(input())
T = str(input())
s = len(S)
t = len(T)
ans = []
for i in range(s-t+1):
    count = 0
    U = S[i:i+t]
    for j in range(t):
        if U[j] != T[j]:
            count += 1
    ans.append(count)

print (min(ans))

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

n = len(s)
m = len(t)
ans = 10**9

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

print(ans)

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

S = str(input())
T = str(input())
mn = 100000

for i in range(len(S)-len(T)+1):
    s = S[i:i+len(T)]
    x = count_diff(s,T)
    mn = min(mn,x)

print(mn)

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

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

Solution (Python):




S = input()

T = input()
min = len(T)


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

Solution (Python):

st1 = input()
st2 = input()
li = []
count = 0

k = 0

for i in range(len(st1)-len(st2)+1):
    for s2 in st2:
        if s2 in st1[i+k]:
            count += 1
        k += 1
    li.append(count)
    count = 0
    k = 0

print(len(st2) - max(li))

Solution (Python):
S=input()
T=input()
lenS=len(S)
lenT=len(T)
count=[]

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

Solution (Python):
def main(S, T):
    ans = len(T)
    for w in range(len(S)-len(T)+1):
        tmp = len(T)
        for s, t in zip(S[w:w+len(T)], T):
            if s == t:
                tmp -= 1
        if tmp < ans:
            ans = tmp
    return ans

if __name__ == '__main__':
    S = input()
    T = input()
    ans = main(S, T)
    print(ans)

Solution (Python):
s = input()
t = input()
T = list(t)
sl = len(s)
tl = len(t)
ans = 10**18

for i in range((sl-tl)+1):
  cnt = 0
  S = list(s[i:i+tl])
  for a,b in zip(S,T):
    if a != b:
      cnt += 1
  if ans > cnt:
    ans = cnt
print(ans)

Solution (Python):

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

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

Solution (Python):
from sys import stdin
def i():
    return stdin.readline().rstrip()
def mi():
    return map(int(),stdin.readline().rstrip().split())
def li():
    return list(map(int,stdin.readline().rstrip()))
ans=10000
s=i()
t=i()
ls=len(s)
lt=len(t)
l=ls-lt
for i in range(l+1):
    cnt=0
    for j in range(lt):
        if s[i+j]!=t[j]:
            cnt+=1
    if cnt<ans:
        ans=cnt

print(ans)

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

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

Solution (Python):
import math
import itertools



def calc_digit_sum(num):
    digits = sums = 0
    while num > 0:
        digits += 1
        sums += num % 10
        num //= 10
    return digits, sums


s = input()
t = input()

answer = len(t)
for index in range(len(s) - (len(t) - 1)):
    d = s[index:index+len(t)]
    match = 0
    for idx in range(len(t)):
        if t[idx] == d[idx]:
            match += 1

    answer = min(answer, len(t) - match)

print(answer)

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

import math


def calculate(s, t):
    lenS = len(s)
    lenT = len(t)

    count = math.inf

    for i in range(lenS - lenT + 1):
        value = s[i:i + lenT]

        tmp = 0
        isOk = True
        for j in range(len(value)):
            if value[j] != t[j]:
               tmp += 1
               if tmp > count:
                   isOk = False
                   break

        if isOk:
            count = min(count, tmp)

    print(count)
calculate(S, T)

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

Solution (Python):
s = input()
t = input()
len_s = len(s)
len_t = len(t)
ans = len_t
for i in range(len_s - len_t + 1):
    tmp_cnt = 0
    tmp_s = s[i:i + len_t]
    for c1, c2 in zip(tmp_s, t):
        if c1 != c2:
            tmp_cnt += 1
    ans = min(ans, tmp_cnt)
print(ans)

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

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

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

print(ans)

Solution (Python):
s = input()
t = input()
s_l = len(s)
t_l = len(t)
s_l -= (t_l-1)
if(t in s):
    print(0)
    exit()

ma = 0
for si in range(s_l):
    cnt = 0
    for ti in range(t_l):
        if(s[si+ti]==t[ti]):
            cnt += 1
    ma = max(ma,cnt)

print(t_l - ma)

Solution (Python):
s=input()
t=input()
scorelist=[]
for i in range(len(s)-len(t)+1):
  S=s[i:i+len(t)]
  score=0
  for j in range(len(t)):
    if S[j]!=t[j]:
      score+=1
  scorelist.append(str(score))
point=min(scorelist)
print(point)

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

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

print(ans)