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



Sample input:
cabacc
abc


Sample output:
1

Submission status: Accepted

Solution code:
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 T[j] != S[i+j]:
      c+=1
  ans = min(c,ans)
print(ans)

Submission status: Accepted

Solution code:
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7

from math import gcd

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

s = ri()
t = ri()

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

Submission status: Accepted

Solution code:
S = input()
T = input()
ans = -1
for i in range(0,len(S)-len(T)+1):
    count = 0
    for j in range(len(T)):
        if S[i+j] == T[j]:
            count += 1
    if count > ans:
        ans = count

print(len(T) - ans)

Submission status: Accepted

Solution code:
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:input()

"""========main code==============="""
t=1
#t=ii()
for _ in range(t):
    a=ip()
    b=ip()
    n=len(a)
    m=len(b)
    mn=1e18
    for i in range(n-m+1):
        cnt=0
        for j in range(m):
            if(a[i+j]!=b[j]):
                cnt+=1
        mn=min(mn,cnt)
    print(mn)

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    S = input()
    T = input()
    ans = 1001
    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(ans, temp)
    print(ans)



if __name__ == '__main__':
    main()

Submission status: Accepted

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

n_t = len(t)

res = n_t

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

print(res)

Submission status: Accepted

Solution code:
S = str(input())
T = str(input())
n = len(S)
m = len(T)
ans = m
for i in range(n-m+1):
    x = m
    s = S[i:i+m]
    for j in range(m):
        if s[j] == T[j]:
            x -= 1
    ans = min(ans, x)

print(ans)

Submission status: Accepted

Solution code:
s=input()
t=input()
anses=[]
for i in range(0,len(s)-len(t)+1,1):
    cnt=0
    for j in range(len(t)):
        if s[i+j]==t[j]:
            cnt+=1
    anses.append(cnt)
print(len(t)-max(anses))

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
input = sys.stdin.readline
INF = float("inf")


# 処理内容
def main():
    S = input()[:-1]
    T = input()[:-1]

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import numpy as np
import math  # gcdもあるよ
from collections import deque
from collections import defaultdict
from copy import deepcopy
from itertools import accumulate #リストを与えると累積和を返す
def input(): return sys.stdin.readline().rstrip()
from functools import lru_cache #メモ化
INF = 10**9

def main():
    S1 = list(input())
    S2 = list(input())
    min_ans = INF
    for i in range(len(S1) - len(S2) + 1):
        temp_ans = 0
        for j in range(len(S2)):
            if S1[i+j] != S2[j]:
                temp_ans += 1
        #print(temp_ans)
        if min_ans > temp_ans:
            min_ans = temp_ans
    print(min_ans)

    #print(S1, S2)
    return 0

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
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 T[j] != S[i + j]:
            diff += 1
    if diff < ans:
        ans = diff
print(ans)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
T = input()
mi = 10 ** 9
for i in range(len(S) - len(T)+1):
    a = S[i:i+len(T)]
    # print(a)
    tmp = 0
    for j in range(len(T)):
        if T[j] != a[j]:
            tmp += 1
    mi = min(mi, tmp)
print(mi)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:

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

def main():
    mod=10**9+7
    S=input()
    T=input()
    N=len(S)
    M=len(T)
    ans=10000
    
    for i in range(N-M+1):#Sのi文字字目から
        temp=0
        for j in range(M):#Tのj文字目
            if S[i+j]!=T[j]:
                temp+=1
                
        ans=min(ans,temp)
        
    print(ans)

main()

Submission status: Accepted

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

lt = len(t)

minc = 1000
for i in range(len(s)):
  ress = s[i:i + lt]
  if len(ress) != lt:
    break
  
  minc = min(minc, sum([1*(x != y) for x,y in zip(ress, t)]))
print(minc)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return float(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()


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


	ans=10**6
	#print(ans)

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

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

	print(ans)














if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
s=str(input())
t=str(input())
m=len(s)
n=len(t)
ct=n
for i in range (m-n+1):
    z=0
    for j in range(n):
        if s[i+j]!=t[j]:
            z+=1
    if z<ct:
        ct=z
print(ct)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
s = input()
t = input()
s_len = len(s)
t_len = len(t)
ans = float("inf")

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


for i in range(s_len - t_len + 1):
    ans = min(ans, dif_string(s[i:i+t_len], t, t_len))
print(ans)

Submission status: Accepted

Solution code:
S=input()
T=input()
N=len(S)
M=len(T)
i=0
ans=10**9
while i+M<=N:
    ans=min(ans,sum(s!=t for s,t in zip(S[i:i+M],T)))
    i+=1
print(ans)

Submission status: Accepted

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

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

ans = 0
for i in range(slen-tlen+1):
    tmp = s[i:i+tlen]
    count = 0
    for tm, tt in zip(tmp, t):
        if tm == tt:
            count += 1
    ans = max(ans, count)
print(tlen - ans)

Submission status: Accepted

Solution code:
def resolve():
    S = input()
    T = input()
    sl = len(S)
    tl = len(T)
    mn = 10000
    for i in range(sl - tl+1):
        count = 0
        #print(T,S[i:i+tl])
        for j,k in zip(T,S[i:i+tl]):
            if j!=k:
                count+=1
        
        mn=min(mn,count)
    print(mn)
resolve()

Submission status: Accepted

Solution code:
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil
s = input()
t = input()
ls = len(s)
lt = len(t)
ans = 10**9
for i in range(0,ls-lt+1):
    #print(i,i+lt-1)
    tmp=0
    for j in range(lt):
        if t[j]!=s[i+j]:
            tmp+=1
    ans =min(ans,tmp)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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


ans = len(t)

for start in range(len(s) - len(t) + 1):
    diff = sum(ch1 != ch2 for ch1, ch2 in zip(t, s[start: start + len(t)]))
    ans = min(ans, diff)
print(ans)

Submission status: Accepted

Solution code:
s=input()
t=input()
ans=float('inf')
for i in range(len(s)-len(t)+1):
    a=s[i:i+len(t)]
    tans=0
    for i in range(len(t)):
        tans+=(t[i]!=a[i])
    ans=min(ans,tans)
print(ans)

Submission status: Accepted

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

len_t = len(t)

dif = 1001
for i in range(len(s)-len_t+1):
    dif = min(dif, sum([x !=  y for x, y in zip(s[i:i+len_t], t)]))

print(dif)

Submission status: Accepted

Solution code:

#!/usr/bin/python
# -*- coding: utf-8 -*-

# def
def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(map(int,input().split())))
    return np.array(x)

def str_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(input()))
    return np.array(x)

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

def int_list():
    return list(map(int,input().split()))

def print_space(l):
    return print(" ".join([str(x) for x in l]))

# import
import numpy as np
import collections as col

# main code
S = input()
T = input()

a = len(T)

b = []

for i in range(0,len(S)-a+1):
    b.append(S[i:i+a])

ans = 10000

for i in range(0,len(S)-a+1):
    aa = 0
    for j in range(0,a):
        if not b[i][j] == T[j]:
            aa += 1
    ans = min(ans,aa)

print(ans)

Submission status: Accepted

Solution code:
S = str(input())
T = str(input())
lenS = len(S)
lenT = len(T)

n = lenS-lenT+1
ans = []

for i in range(n):
  c = 0
  for j in range(lenT):
    if S[j+i] != T[j]:
      c += 1
  ans.append(c)

print(min(ans))

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]

mod=10**9+7


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

print(len(t)-ans)

Submission status: Accepted

Solution code:
S = input()
T = input()
ans = 999999
for start in range(len(S)-len(T)+1):
    temp = 0
    for n,t in enumerate(T):
        if S[n+start] != t:
            temp += 1
    ans = min(temp,ans)
print(ans)

Submission status: Accepted

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

l=len(s)
ll=len(t)
count=10000
for i in range(l-ll+1):
    v=0
    for j in range(ll):
        
        if s[i+j]!=t[j]:
            v=v+1

        if j==ll-1:
            count=min(count,v)
print(count)

Submission status: Accepted

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

lendif = len(s) - len(t)

min_global = len(s)

for i in range(lendif + 1):
  beg = i
  end = i + len(t)
  sl = s[beg:end]
  m = 0
  for j in range(len(t)):
    if t[j] != sl[j]:
      m += 1
  if m < min_global:
    min_global = m

print(min_global)

Submission status: Accepted

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

ans = 100000

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

for i in range(n - m + 1):
    temp = s[i:i + m]
    count = 0
    for a, b in zip(temp, t):
        if a != b:
            count += 1
    ans = min(count, ans)

print(ans)

Submission status: Accepted

Solution code:



#for _ in range(int(input())):
#n=int(input())
#d,t,s=[int(x) for x in input().split()]  

def fun(s,t):
    ans=0
    for i in range(len(t)):
        if s[i]!=t[i]:
           ans+=1
    return ans       


s=input()
t=input()        
m=len(t)
for i in range(0,len(s)-len(t)+1):
   
     m=min(m,fun(s[i:i+len(t)],t))
    
     if m==0:
         break

print(m)

Submission status: Accepted

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

ans = 1000

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

Submission status: Accepted

Solution code:
s = input()
t = input()
ans = 10000
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)

Submission status: Accepted

Solution code:
S = input()
T = input()
ans = 0
for i in range(len(S)-(len(T)-1)):
    tmp = 0
    for k in range(len(T)):
        if T[k] == S[k+i]:
            tmp += 1
    ans = max(ans,tmp)
print(len(T)-ans)

Submission status: Accepted

Solution code:
import os
import heapq
import sys,threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10**5)
from io import BytesIO, IOBase
def gcd(a,b):
    if b==0:

        return a
    else:
        return gcd(b,a%b)
def power(x, p,m):
    res = 1
    while p:
        if p & 1:
            res = (res * x) % m
        x = (x * x) % m
        p >>= 1
    return res
def inar():
    return [int(k) for k in input().split()]

def lcm(num1,num2):
    return (num1*num2)//gcd(num1,num2)

def main():
    #t=int(input())
    t=1
    for _ in range(t):

        mn=input()
        s=input()
        n=len(s)
        ans=10**10
        for i in range(len(mn)-n+1):
            #print(i)
            temp=0
            for j in range(n):
                if s[j]!=mn[i+j]:
                    temp+=1
            ans=min(ans,temp)
        print(ans)



BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()
    #threadin.Thread(target=main).start()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = []
for i in range(len(s) - len(t) + 1):
    ans.append(sum([x != y for x, y in zip(s[i:i + len(s)], t)]))

print(min(ans))

Submission status: Accepted

Solution code:
S = input().rstrip()
T = input().rstrip()
res = float("inf")
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
    res = min(t,res)
print(res)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    s = input()[:-1]
    t = input()[:-1]
    
    ans = 0
    for i in range(len(s)-len(t)+1):
        sub = 0
        for j in range(len(t)):
            if s[i+j] == t[j]:
                sub += 1
        if ans < sub:
            ans = sub
        
    ans = len(t) - ans
    print(ans)
    
    
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
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(tmp,ans)
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()

s = input()
t = input()

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

for i in range(len_s - len_t + 1):
    s1 = s[i:i+len_t]
    cur = 0
    for j in range(len_t):
        if s1[j] == t[j]:
            cur += 1

    if i == 0:
        max_ = cur
    else:
        max_ = max(cur,max_)
out = len_t - max_
print(out)

Submission status: Accepted

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

max_count = 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 temp > max_count:
        max_count = temp

print(len(T)-max_count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    S = input()
    T = input()

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
s=input()
t=input()
a=0
for i in range(len(s)-len(t)+1):
  c=0
  for j,d in enumerate(t):
    if s[i+j]==d: c+=1
  a=max(a,c)
print(len(t)-a)

Submission status: Accepted

Solution code:
ans=10**8
s=input()
t=input()

end=False
for i in range(len(s)):
    cnt=0
    for q in range(len(t)):
        if i+q==len(s):
            end=True
            break
        if s[i+q]!=t[q]:
            cnt+=1
            #print("!")
    if end:
        break
    #print(cnt)
    ans=min(ans,cnt)
print(ans)

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

S = input()
T = input()

l = len(S)
m = len(T)
ans = 1 << 28
for i in range(l - m + 1):
    cnt = 0
    for j in range(m):
        if S[i + j] != T[j]:
            cnt += 1
    ans = min(ans, cnt)

print(ans)

Submission status: Accepted

Solution code:
def main():
    s = input()
    t = input()
    n = len(t)
    ans = 0

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import math
import copy
import heapq
import random
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10 ** 9 + 7
divide = lambda x: pow(x, MOD - 2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n - k])) % MOD


def fact_and_inv(SIZE):
    inv = [0] * SIZE  # inv[j] = j^{-1} mod MOD
    fac = [0] * SIZE  # fac[j] = j! mod MOD
    finv = [0] * SIZE  # finv[j] = (j!)^{-1} mod MOD
    inv[1] = 1
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    for i in range(2, SIZE):
        inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD
        fac[i] = fac[i - 1] * i % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

    return fac, finv


def renritsu(A, Y):
    # example 2x + y = 3, x + 3y = 4
    # A = [[2,1], [1,3]])
    # Y = [[3],[4]] または [3,4]
    A = np.matrix(A)
    Y = np.matrix(Y)
    Y = np.reshape(Y, (-1, 1))
    X = np.linalg.solve(A, Y)

    # [1.0, 1.0]
    return X.flatten().tolist()[0]


class TwoDimGrid:
    # 2次元座標 -> 1次元
    def __init__(self, h, w, wall="#"):
        self.h = h
        self.w = w
        self.size = (h + 2) * (w + 2)
        self.wall = wall
        self.get_grid()
        # self.init_cost()

    def get_grid(self):
        grid = [self.wall * (self.w + 2)]
        for i in range(self.h):
            grid.append(self.wall + getS() + self.wall)

        grid.append(self.wall * (self.w + 2))
        self.grid = grid

    def init_cost(self):
        self.cost = [INF] * self.size

    def pos(self, x, y):
        # 壁も含めて0-indexed 元々の座標だけ考えると1-indexed
        return y * (self.w + 2) + x

    def getgrid(self, x, y):
        return self.grid[y][x]

    def get(self, x, y):
        return self.cost[self.pos(x, y)]

    def set(self, x, y, v):
        self.cost[self.pos(x, y)] = v
        return

    def show(self):
        for i in range(self.h + 2):
            print(self.cost[(self.w + 2) * i:(self.w + 2) * (i + 1)])

    def showsome(self, tgt):
        for t in tgt:
            print(t)
        return

    def showsomejoin(self, tgt):
        for t in tgt:
            print("".join(t))
        return

    def search(self):
        grid = self.grid
        move = [(0, 1), (0, -1), (1, 0), (-1, 0)]
        move_eight = [(0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
        # for i in range(1, self.h+1):
        #     for j in range(1, self.w+1):
        #         cx, cy = j, i
        #         for dx, dy in move_eight:
        #             nx, ny = dx + cx, dy + cy


def solve():
    s = getS()
    t = getS()

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

    ans = INF
    for i in range(ls - lt+1):
        tgt = s[i:i+lt]
        # print(tgt)
        tmp = 0
        for c, d in zip(tgt, t):
            if c != d:
                tmp += 1

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

if __name__ == "__main__":
    # main()
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

ans = len(s)

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

print(ans)

Submission status: Accepted

Solution code:
def distance(s, t):
    return len([1 for (a, b) in zip(s, t) if a != b])

S = input()
T = input()
ans = float('inf')
for i in range(len(S) - len(T) + 1):
    ans = min(ans, distance(T, S[i:i+len(T)]))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

minCount = len(t)
l = len(s) - len(t) + 1
for i in range(l):
    count = 0
    for n in range(len(t)):
        if s[i+n] != t[n]:
            count+=1
    if count < minCount:
        minCount = count
print(minCount)

Submission status: Accepted

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

n_s = len(S)
n_t = len(T)

MaxScore = 0

for i in range(n_t-n_s+1):
    tempT = T[i:i+n_s]
    score = 0
    for j in range(n_s):
        if S[j] == tempT[j]:
            score += 1
    MaxScore = max(score,MaxScore)

print(n_s-MaxScore)

Submission status: Accepted

Solution code:
S = input()
T = input()
itch = 0
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
    itch = max(tmp, itch)
    tmp = 0
print(len(T)-itch)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

N = len(T)
ans = N

for i in range(len(S) - N + 1):
    s = S[i:i+N]
    count = 0
    for j in range(N):
        if s[j] == T[j]:
            pass
        else:
            count += 1
    if ans > count:
        ans = count

print(ans)

Submission status: Accepted

Solution code:
s = input()
t = input()
temp = 0
for i in range(len(s)-len(t)+1):
  ns = s[i:i+len(t)]
  cnt = 0
  for k,l in zip(ns,t):
    if k==l:
      cnt += 1
  temp = max(cnt,temp)
print(len(t)-temp)

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
a=[]
for i in range(int(len(s))-int(len(t))+1):
  g=0
  for j in range(int(len(t))):
    if s[i+j]!=t[j]:
      g=g+1
  a.append(g)
print(min(a))