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








































ma = 0
s = len(S)
t = len(T)
for i in range(s - t + 1):
    cnt = 0
    for j in range(t):
        if S[i + j] == T[j]:
            cnt += 1
    if cnt > ma:
        ma = cnt
print(t - ma)

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

s_l = len(s)
t_l = len(t)

ans = len(t)

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


print(ans)

Solution (Python):
def main():
    S = input()
    T = input()
    l_s = len(S)
    l_t = len(T)

    cnt_list = []
    for i in range(l_s - l_t + 1):
        cnt = 0
        S_ = S[i: i+l_t]
        for j in range(l_t):
            if S_[j] != T[j]:
                cnt += 1
        cnt_list.append(cnt)

    ans = min(cnt_list)
    print(ans)
    return


if __name__ == '__main__':
    main()

Solution (Python):

import sys


def resultSur97(x):
    return x % (10 ** 9 + 7)


if __name__ == '__main__':
    
    
    s = input()    
    t = input()    

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

    
    print("{}".format(sMin))

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

cnt = 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
        cnt = max(same, cnt)
print(len(T)-cnt)

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

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

lt = len(t)
ans = lt

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

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

Solution (Python):
S = list(input())
T = list(input())
ls = len(S)
lt = len(T)
ans = lt
for i in range(ls):
    temp = 0
    if i+lt > ls:
        break
    subS = S[i:i+lt]
    for ss, st in zip(subS, T):
        if ss != st:
            temp += 1
    ans = min(ans, temp)
print(ans)

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

print(result)

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

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

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

def f(k):
    c = 0
    for i in range(len(t)):
        if s[k + i] == t[i]:
            c += 1
    return c

maxi = f(0)
for i in range(len(s) - len(t) + 1):
    if f(i) > maxi:
        maxi = f(i)

print(len(t) - maxi)

Solution (Python):
S = input()
T = input()
ans = 99999999
for i in range(len(S)-len(T)+1):
    word = S[i:i+len(T)]
    cnt = 0
    for j in range(len(word)):

        if word[j]!=T[j]:
            cnt+=1
    ans = min(ans,cnt)
print(ans)

Solution (Python):






S = input()
T = input()



ans = 1000000

for i in range(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 = min(ans, score)
    
print(ans)

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

    mn = 10**5
    for i in range(len(s)-len(t)+1):
        result = 0
        for j in range(len(t)):
            if s[i+j] != t[j]:
                result += 1
        mn = min(result, mn)

    print(mn)


if __name__ == '__main__':
    main()

Solution (Python):
S = str(input())
T = str(input())
if T in S:
  print(0)
  exit()
ans, substr = 0, ""
for i in range(len(S) - len(T) + 1):
  substr = S[i: i + len(T)]
  cnt = 0
  for s, t in zip(substr, T):
    if s == t:
      cnt += 1
  ans = max(ans, cnt)
  if ans == len(T) - 1:
    break
print(len(T) - ans)

Solution (Python):
S = input()
T = input()
ans = 1000000  
for i in range(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 = min(ans, score)

print(ans)

Solution (Python):

import sys


def solve(S: str, T: str):
    min_change = 100000000

    S = [s for s in S]
    T = [t for t in T]

    for i, s in enumerate(S):
        for j, t in enumerate(T):
            if j == 0:
                c = 0
            if len(S) <= i + j:
                break
            if S[i+j] != t:
                c += 1
            if len(T) == j + 1:
                min_change = min(min_change, c)

    print(min_change)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  
    T = next(tokens)  
    solve(S, T)

if __name__ == '__main__':
    main()

Solution (Python):
s=input()
t=input()
lent=len(t)
num=lent
ls=[]
count=0

for i in range(len(s)-lent+1):
  st=s[i:i+num]
  num+=1
  
  for j in range(lent):
    if st[j]!=t[j]:
      count+=1
      
  ls.append(count)
  count=0
  
print(min(ls))

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

ls = len(s)
lt = len(t)
ret = lt
for i in range(ls+1 - lt):
  diff = 0
  for j in range(lt):
    diff += (t[j] != s[i+j])
  if diff == 0:
    ret = diff
    break
  if diff < ret:
    ret = diff
print(ret)

Solution (Python):
s = input()
t = input()
a = len(s) - len(t) + 1
c1= 0

for i in range(a):
    c2 = 0
    for j in range(len(t)):
        if s[i+j] == t[j]:
            c2 += 1
        else:
            continue
    c1 = max(c1,c2)


print(len(t)-c1)

Solution (Python):
s=input()
t=input()
if len(s)==len(t):
    cm=0
    for i in range(len(s)):
        if s[i]!=t[i]:
            cm+=1
else:
    cm=1000
    for i in range(len(s)-len(t)):
        cn=0
        for j in range(len(t)):
            if s[i+j]!=t[j]:
                cn+=1
        cm=min(cm,cn)

print(cm)

Solution (Python):
import sys












stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    s = str(stdin.readline().rstrip())
    t = str(stdin.readline().rstrip())
    
    
    
    
    
    ans = len(t)
    for i in range(len(s)-len(t) + 1):
        test = s[i:i+len(t)]
        a = len(t)
        for j in range(len(t)):
            if test[j] == t[j]:
                a -= 1
        ans = min(ans,a)
    print(ans)

if __name__ == '__main__':
    solve()

Solution (Python):
S,T = open(0).read().split()
ls = len(S)
lt = len(T)
ans = float('inf')
for i in range(ls-lt+1):
    temp = S[i:i+lt]
    t2 = 0
    for j in range(lt):
        if temp[j] != T[j]:
            t2 += 1
    ans = min(ans,t2)
print(ans)

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

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

ans = len(t)

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

print(ans)

Solution (Python):
import sys

input = sys.stdin.readline



S = input()
T = input()

S = S.replace('\n','')
T = T.replace('\n','')

s_list = list(S)
t_list = list(T)

itti = 0
min_count = 10**5
for i in range(len(s_list)):
    if i + len(t_list) > len(s_list):
        break
    count = 0
    for j in range(len(t_list)):
        if not s_list[i+j] == t_list[j]:
            count += 1
    min_count = min(count,min_count)

print(min_count)

Solution (Python):


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

    ans = len(t)
    
    for i in range(len(s) - len(t) + 1):
        a = s[i:i+len(t)]
        
        ans_list = [1 for x, y in zip(a, t) if x!=y]
        tmp_ans = sum(ans_list)
        ans = min(ans, tmp_ans)
        
        if ans == 0:
            break
        
    print(ans)
    
        

main()

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

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

lens = len(S)
lent = len(T)

cur_ans = 999999999999

for i in range(lens - lent + 1):
    local_ans = 0
    for j in range(lent):
        if T[j] != S[i+j]:
            local_ans += 1
    
    cur_ans = min(cur_ans, local_ans)

print(cur_ans)

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

ans=0

for i in range(len(S)-len(T)+1):
    c=0
    I=i
    t=0
    for j in range(len(T)):
        if S[I]==T[t]:
            c+=1
        t+=1
        I+=1
    ans=max(c,ans)

print(len(T)-ans)

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

min = 10000000

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

Solution (Python):



S = input()
T = input()

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

print(ans)

Solution (Python):
S=input()
T=input()
A=[]
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
    A.append(ans)

print(min(A))

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

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

def d(s,t):
  return sum([1 if i!=j else 0 for i,j in zip(s,t)])

print(min([d(S[i:], T) for i in range(len(S)-len(T) + 1)]))

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

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

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

lens = len(S)
lent = len(T)

ans = lent

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

  if count < ans:
    ans = count
    
print(ans)

Solution (Python):
s = str(input())
t = str(input())
a = []
for i in list(s):
    a.append(i)
b = []
for j in list(t):
    b.append(j)
c = len(a)
d = len(b)
w = 1000
for k in range(c-d+1):
    e = a[k:k+d]
    f = 0
    for l in range(d):
        if e[l] != b[l]:
            f= f+1
    if w > f:
         w= f
print(w)

Solution (Python):
s = input()
t = input()
cnt = 0
ans = 0
while cnt < len(s) - len(t) + 1:
    chk = 0
    for i, j in zip(range(cnt,cnt+len(t)),range(len(t))):
        if s[i] == t[j]:
            chk += 1
    ans = max(ans,chk)
    cnt += 1

print(len(t) - ans)

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

answer = 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 = count + 1
	if count < answer:
		answer = count
print(answer)

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

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

ans = 10000000
for i in range(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 = min(ans, score)

print(ans)

Solution (Python):
S = input()
T = input()
lens = len(S)
lent = len(T)

ans = -1
for i in range(lens-lent+1):
    S2 = S[i:i+lent]
    diff = 0
    for j in range(lent):
        if S2[j] != T[j]:
            diff += 1
    if ans == -1:
        ans = diff
    else:
        if ans > diff:
            ans = diff
print(ans)

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

sl = len(S)
tl = len(T)

minc = 1000

for i in range(sl):
    if i+tl-1 >= sl:
        break
    else:
        str1 = S[i:i+tl]
        count=0
        for j in range(tl):
            if str1[j] != T[j]:
                count+=1
        if count < minc:
            minc = count

print(minc)

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

ans = 0
for i in range(ls-lt+1):
  same = 0
  for j in range(lt):
    ind = i+j
    if s[ind]==t[j]:
      same += 1
  ans = max(ans,same)
print(lt-ans)

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

Solution (Python):
S = input()
T = input()
t_len = len(T)
count = len(S) - len(T) + 1
max_correct = []
for i in range(count):
  s_tmp = S[i:t_len]
  correct = 0
  for n, s in enumerate(s_tmp):
    if s == T[n]:
      correct += 1
  max_correct.append(correct)
  
  i = i + 1
  t_len = t_len + 1

max_correct = len(T) - max(max_correct)
print(max_correct)

Solution (Python):
"""B."""

import sys

input = sys.stdin.readline  

S = input()[:-1]
T = input()[:-1]

S_L = len(S)
T_L = len(T)
ans = T_L

for i in range(S_L - T_L + 1):
    S_2 = S[i:i + T_L]
    match = 0
    for v1, v2 in zip(S_2, T):
        match += bool(v1 != v2)
    ans = min(ans, match)

print(ans)

exit(0)

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

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

print(ans)

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

N = len(S)
M = len(T)
ans = M
for i in range(N-M+1):
    cnt = 0
    for j in range(M):
        if T[j] != S[i:i+M][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 T[j] != S[i:i+len(T)][j]:
            cnt += 1
    ans = min(ans, cnt)

print(ans)

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

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

print(ans)

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

lt, ls = len(T), len(S)

def diff(s1, s2):
    d = len(s1)

    d -= len([i for i,j in zip(s1, s2) if i == j])
    return d

dlen = min([diff(T, S[i:i+lt]) for i in range(ls) if i + lt <= ls])

print(dlen)

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




lt = len(T)

def diff(s1, s2):
    d = len(s1)

    d -= len([i for i,j in zip(s1, s2) if i == j])
    return d

dlen = 1000000000
for i in range(len(S)):
    if i + lt <= len(S):
        dlen = min(dlen, diff(T, S[i:i+lt]))

print(dlen)

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

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

res = 0
for i in range(n+1):
    cnt = 0
    for j in range(l):
        if s[i+j] == t[j]:
            cnt += 1
    res = max(res, cnt)

print(l - res)

Solution (Python):
S = input()
T = input()
largest = 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 largest < count:
        largest = count
print(len(T) - largest)

Solution (Python):
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
import random
J=10**19

s=input()
t=input()
ans=10**6
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(count,ans)
print(ans)

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(10000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

if __name__ == "__main__":
    s = input()
    t = input()
    ans = 10**9
    for i in range(len(s)-len(t)+1):
        cnt = 0
        for j in range(len(t)):
            if s[i+j] != t[j]:
                cnt+=1
        ans = min(ans,cnt)
    print(ans)

Solution (Python):
def main() :

    s = input()
    t = input()

    if (t in s) :
        print(0)
        return
    
    difference = 99999999
    for offset in range(0,len(s) - len(t)+1):
        s2 = s[offset:offset+len(t)]
        diff = 0
        for i in range(len(t)) :
            if (s2[i] != t[i]) :
                diff += 1
        
        if (difference > diff) :
            difference = diff
    
    print(difference)

main()

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

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

ans = 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
    if ans < c:
        ans = c
print(len(t)-ans)

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

a = []

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
    a.append(count)
print(len(t)-max(a))

Solution (Python):
str1 = list(input())
str2 = list(input())

answer = len(str2)
for i in range(len(str1)-len(str2)+1):
    count = 0

    for j in range(len(str2)):
        if not str1[i+j] == str2[j]:
            count += 1

    if count < answer:
        answer = count

print(answer)

Solution (Python):


s = input()
t = input()

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

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

maxx = 0

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

print(len(t) - maxx)

Solution (Python):
S, T = input(), input()
ans = 2**10
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):
long_str = input()
short_str = input()
short_list = list(short_str)

long_len = len(long_str)
short_len = len(short_str)
iter_num = long_len - short_len + 1

max_count = 0
for i in range(iter_num):
  tmp = 0
  obj_list = list(long_str[i:(short_len+i)])
  for s, o in zip(short_list, obj_list):
    tmp += int(s == o)
  max_count = max(max_count, tmp)

print(short_len - max_count)

Solution (Python):
s = input()
t = input()
c = 0
ctemp = 0 

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

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

ans = len(t)
long = ans

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

print(ans)

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


max = 0

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

print(len(t)-max)

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

ans = float('INF')
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):
s = input()
t = input()
minimam = 10000

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
    minimam = min(minimam, count)


print(minimam)

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

ans = 1000000  



for i in range(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 = min(ans, score)

print(ans)

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

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

ans = float("inf")
for i in range(n-m+1):
  p = m
  for j in range(m):
    if s[i+j] == t[j]: p -= 1
  if p < ans: ans = p
print(ans)

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


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

print(ans)

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

print(ans)

Solution (Python):


def count(a, b):
    ans = 0
    for i, j in zip(a, b):
        if i != j:
            ans += 1
    return ans

s = input()
t = input()

ans = len(s)

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

print(ans)

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

Solution (Python):

printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 10**18
R = 10**9 + 7


def ddprint(x):
  if DBG:
    print(x)

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

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

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

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

Solution (Python):
s = input()
t = input()
if s.count(t):
    print(0)
else:
    len_t = len(t)
    cnt = 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
        cnt = max(cnt, c)
    print(len_t - cnt)

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

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

print(ans)

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

Nmax = len(T)
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

    Nmax = min(diff, Nmax)

print(Nmax)

Solution (Python):
s = input()
t = input()
n = len(s)
m = len(t)
a,x = m,m
for i in range(n-m+1):
  x=m
  for j in range(m):
    x -= s[i+j] == t[j]
  a = min(a,x)
print(a)

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

for _ in range(len(s)):
  if _+len(t)>len(s):
    break
  mj=s[_:_+len(t)]
  for i in range(len(t)):
    if mj[i]!=t[i]:
      cnt += 1
  if ans>cnt:
    ans=cnt
  cnt=0
    
print(ans)

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

ans = len(t)

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):
def main():
    a = [input() for i in range(2)]
    S = a[0]
    T = a[1]
    count = 1001
    
    for i in range(len(S) - len(T) + 1):
        count_temp = 0
        for j in range(len(T)):
            if S[i + j] != T[j]:
                count_temp += 1
        count = min(count, count_temp)
        if count == 0:
            break
    print(count)


if __name__ == '__main__':
    main()

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

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

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


for i in range(s-t+1):
  word=S[i:i+t]
  a=0
  for j in range(t):
    if word[j]==T[j]:
      a+=1
    else:
      a+=0
  A.append(t-a)

print(min(A))

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

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

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

print(x)

Solution (Python):
S = str(input())
T = str(input())
lenS = len(S)
lenT = len(T)
max_match = 0
for idx in range(lenS - lenT + 1):
    cnt_match = 0
    for i in range(lenT):
        if S[idx + i] == T[i]:
            cnt_match += 1
    if cnt_match > max_match:
        max_match = cnt_match
print(lenT - max_match)

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

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

Solution (Python):
S = input()
T = input()
 
def match_num_character(x, y):
  count = 0
  for a, b in zip(x, y):
    if a == b:
      count += 1
      
  return count
 
length = len(T)
max_count = max([match_num_character(S[i:i+length], T) for i in range(1+len(S) - length)])
 
print(length - max_count)

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

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>result:
        result=count


print(len(t)-result)

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

ans = 1000

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
    if ans > diff:
        ans = diff

print(ans)

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

Solution (Python):
S = input()
T = input()
ans = len(T)
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()
a = len(s)
b = len(t)
ans = 2000
for i in range(a-b+1):
  k = 0
  for j in range(b):
    if s[i+j] != t[j]:
      k += 1
  ans = min(ans,k)
print(ans)

Solution (Python):
S = input()
T = input()
ans = float('inf')

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

print(ans)

Solution (Python):
S = input()
T = input()
min_change = 10**9
for posi_1 in range(len(S)-len(T)+1):
  tmp = 0
  for posi_2 in range(len(T)):
    if S[posi_1+posi_2] != T[posi_2]:
      tmp += 1
  min_change = min(tmp, min_change)
print(min_change)

Solution (Python):




a = input()
b = input()

s = 1001

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

print(s)

Solution (Python):


a=input()
b=input()

c,d=[],[]
for i in a:
    c.append(i)
for i in b:
    d.append(i)






ma=[]
if b in a:
    print(0)
else:
    for i in range(len(c)-len(d)+1):
        count=0
        for k in range(len(d)):
            if c[i:len(d)+i][k]!=d[k]:
                count+=1
        ma.append(count)
    print(min(ma))

Solution (Python):
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=input()
t=input()
L=len(s)
l=len(t)
X=[]
for i in range(L-l+1):
    x=0
    for j in range(l):
        if s[i+j]!=t[j]:
            x+=1
    X.append(x)
print(min(X))

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

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

print(min(ans))

Solution (Python):
S = str(input())
T = str(input())
lenS = len(S)
lenT = len(T)
max_match = 0
for idx in range(lenS - lenT + 1):
    cnt_match = 0
    for i in range(lenT):
        if S[idx + i] == T[i]:
            cnt_match += 1
    if cnt_match > max_match:
        max_match = cnt_match
print(lenT - max_match)

Solution (Python):

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

Solution (Python):
S=list(input())
T=list(input())
A=[]
for i in range(len(S)-len(T)+1):
    B=0
    for j in range(len(T)):
        if T[j]==S[i+j]:
            continue
        else:
            B =B+1
    A.append(B)

A.sort()
print(A[0])

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

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

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

print(min)

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

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

print(len(t) - c)

Solution (Python):
from sys import stdin
def ip(): return [int(i) for i in stdin.readline().split()]
def sp(): return [str(i) for i in stdin.readline().split()]


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

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