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: Wrong Answer

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

n = len(t)

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplt(n): return [tuple(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

s = input()
t = input()

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

print(ans)

Submission status: Wrong Answer

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

S = input()
T = input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint

#oo=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# ko=list("abcdefghijklmnopqrstuvwxyz")

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def main():
    #l,r,d=map(int,input().split())
    s=input()
    t=input()
    count=len(t)
    temp=0
    for i in range(len(s)-len(t)):
        temp=0
        for j in range(len(t)):
            if s[i+j]!=t[j]:
                temp+=1
        count=min(temp,count)
    print(count)



if __name__ == "__main__":

    main()

Submission status: Wrong Answer

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

L = len(s)
l = len(t)
Ans = 1000

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

print(Ans)

Submission status: Wrong Answer

Solution code:
s = input()
l = len(s)
s += "!"*1000
t = input()
ans = 1001
for i in range(l):
    cnt = 0
    for j in range(len(t)):
        if s[i+j] != t[j]: cnt += 1
    ans = min(ans,cnt)
print(ans)

Submission status: Wrong Answer

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

size = len(T)
n = len(S)
ans = size

for i in range(n-size+1):
    t = S[i:i+size]
    print(t)
    v = sum([k!=j for k, j in zip(T, t)])
    ans = min(v, ans)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#long
long=input()

#short
short=input()

maximum_same=0
for i in range(len(long)-len(short)):
  newLong=long[i:i+len(short)]
  same=0
  for j in range(len(short)):
    if newLong[j]==short[j]:
      same+=1
  if same>maximum_same:
    maximum_same=same

print(len(short)-maximum_same)

Submission status: Wrong Answer

Solution code:
def hw(a,b):
  w = 0
  for i,j in zip(a,b):
    #print(i,j)
    if i == j:
      w+=1
  return w

s = input()
t = input()
ans = len(t)
tl = len(t)
for i in range(len(s)):
  tmp = tl - hw(s[i:i+tl], t)
  ans = min(tmp, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

s = readline().rstrip().decode('utf-8')
t = readline().rstrip().decode('utf-8')
ls = len(s)
lt = len(t)
ans = 10**18
for i in range(ls-lt):
    res = 0
    for j in range(lt):
        if s[i+j] != t[j]:
            res += 1
    ans = min(ans,res)

print(ans)

Submission status: Wrong Answer

Solution code:
# = map(int, input().split())
# = int(input())
S = input()
T = input()
N = len(S)
M= len(T)
ans = N


for j in range(N- M):
  change = 0
  for l in range(M):
    if S[j+l] != T[l]:
      change += 1
  ans = min(ans, change)
print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

ans = 1000

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

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
S = input()
T = input()
max = len(S)
for i in range(len(S)-len(T)+1):
    ans = len(T)
    for i,v in zip(T,S[i:i+len(T)]):
        if i == v:
            ans-=1
    if ans < max:
        max = ans
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
#======================================================#
def main():
    s = IS()
    t = IS()
    if t in s:
        print(0)
        return
    len_s = len(s)
    len_t = len(t)
    minv = 10**5
    for i in range(0, len_s - len_t):
        cnt = 0
        for j in range(len_t):
            if s[i+j] != t[j]:
                cnt += 1
        minv = min(minv, cnt)
    print(minv)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

print(len(t)-max)

Submission status: Wrong Answer

Solution code:
import copy

s = input()
t = input()

sn = len(s)
tn = len(t)
answer = int(copy.deepcopy(tn))

for i in range(sn-tn+1):
    sk = s[i:i+tn]
    count = 0
    for j in range(tn):
        if sk[j] != t[j]:
            count += 1
    print(sk,count)
    if count < answer:
        answer = count

print(answer)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

S=input()
T=input()

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

ans=lt

for i in range(ls-lt):
    ss=S[i:i+lt]
    c=0
    for j in range(lt):
        if ss[j]!=T[j]: c+=1

    if c<ans: ans=c

print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
ans = 10**9
for i in range(len(S)-len(T)+1):
    Spart = S[i:i+len(T)]
    #print(Spart)
    temp_ans = 0
    for j in range(len(T)):
        #print(Spart[j],T[j])
        if Spart[j] != T[j]:
            temp_ans += 1
    if temp_ans < ans:
        ans = temp_ans
        
print(temp_ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline


def main():
    S = input()
    T = input()
    N = len(S)
    M = len(T)
    ans = float('inf')
    for i in range(N - M):
        cnt = 0
        for j in range(M):
            if T[j] != S[i:(i + M)][j]:
                cnt += 1
        ans = min(ans, cnt)
    print(ans-1)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import os
import heapq
import sys,threading
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase

sys.setrecursionlimit(10 ** 5)
threading.stack_size(2**27)


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


"""def pw(a,b):
    result=1
    while(b>0):
        if(b%2==1): result*=a
        a*=a
        b//=2
    return result"""


def inpt():
    return [int(k) for k in input().split()]


def main():
    s=input()
    t=input()
    ans=100000000000000
    for i in range(len(s)-len(t)):
        ct=0
        for j in range(len(t)):
            if(s[i+j]!=t[j]):
                ct+=1
        ans=min(ans,ct)
    if(ans==100000000000000):
        ans=0
    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()
    #threading.Thread(target=main).start()

Submission status: Wrong Answer

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

M= len(S)
N = len(T)
ans=0

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

print(N-ans)

Submission status: Wrong Answer

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

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

print(len(t) - ans)

Submission status: Wrong Answer

Solution code:
s1 = input()
s2 = input()

min_diff = len(s2)

for i in range(len(s1)):
    diff_cnt = len(s2)
    for j in range(len(s2)):
        if i + j >= len(s1):
            break
        if s1[i + j] == s2[j]:
            diff_cnt -= 1
        
    if diff_cnt < min_diff:
        min_diff = diff_cnt

print(min_diff)

Submission status: Wrong Answer

Solution code:
def resolve():
    s = input()
    t = input()
    ans = 10**18
    for i in range(len(s) - len(t)):
        a = 0
        for j in range(len(t)):
            if s[i + j] != t[j]:
                a += 1
        if ans > a:
            ans = a

    print(ans)
resolve()

Submission status: Wrong Answer

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

ans = 10**9

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

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ls = len(s)
lt = len(t)
res = 0
for i in range(ls - lt):
    tmp = 0
    for j in range(lt):
        if s[i+j] == t[j]:
            tmp += 1
    res = max(res, tmp)
print(lt - res)

Submission status: Wrong Answer

Solution code:
s = input().rstrip()
t = input().rstrip()
ns = len(s)
nt = len(t)
ans = ns
for i in range(ns-nt+1):
    tmp = s[i:i+nt]
    n=0
    for j in range(nt):
         if tmp[j]!=t[j]:
                n+=1
    if ans>n:
        ans=n
print(n)

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
k1=10**10
for i in range(len(s)-len(t)):
    k=0
    for j in range(len(t)):
        if s[i+j]!=t[j]:
            k+=1
    if k<k1:k1=k
print(k1)

Submission status: Wrong Answer

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

if S in T:
    print('0')
else:
    count = 0
    for i in range(len(S) - len(T)):
        tmp = 0
        for p in range(len(T)):
            if S[i + p] == T[p]:
                tmp += 1
        
        if count < tmp:
            count = tmp
    
    print(len(T) - count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

ans = 10 * 10
for i in range( len( s ) - len( t ) ):
    ans_i = compare( s[ i : i + len( t ) ], t )
    if ans_i < ans:
        ans = ans_i

print( ans )

Submission status: Wrong Answer

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

def longestSubstringFinder(string1, string2):
    answer = ""
    len1, len2 = len(string1), len(string2)
    for i in range(len1):
        match = ""
        for j in range(len2):
            if (i + j < len1 and string1[i + j] == string2[j]):
                match += string2[j]
            else:
                if (len(match) > len(answer)): answer = match
                match = ""
    return answer

X = longestSubstringFinder(S,T)

print(len(T)-len(X))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
s = input()
t = input()
min_count = 1000
for i in range(len(s) - len(t)):
    count = 0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            count += 1
    min_count = min(count, min_count)
    if min_count == 0:
        break
print(min_count)

Submission status: Wrong Answer

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

if T in S:
  print(0)
  exit()

for i in range(1, len(T)):
  if T[i:] in S[i:]:
    print(i)
    exit()
  elif T[:-i] in S[:-i]:
    print(i)
    exit()

print(len(T))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
mx_match=0
for i in range(len(s)-len(t)):
  mx_match=max(mx_match,sum(s[i+j]==t[j] for j in range(len(t))))
print(len(t)-mx_match)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(cnt_min)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

s = input()[:-1]
t = input()[:-1]

ans = len(t)
for i in range(len(s) - len(t)):
    tmp = sum(s[i + j] != t[j] for j in range(len(t)))
    ans = min(ans, tmp)
print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
NS=len(S)
NT=len(T)
ans=pow(10,9)
for n in range(NS-NT):
    suuji=0
    for m in range(NT):
        if S[n+m]!=T[m]:
            suuji+=1
    ans=min(ans,suuji)
print(ans)

Submission status: Wrong Answer

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

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

print(len(t)-count_max)

Submission status: Wrong Answer

Solution code:
import sys

S = sys.stdin.readline().strip()
T = sys.stdin.readline().strip()

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

print(lt - match)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
 
S = input()
T = input()
score_list = []
for i in range(0, len(S)-len(T)+1):
  s = S[i:i+len(T)]
  score = sum([1 if s[i]==T[i] else 0 for i in range(len(s))])
  score_list.append(score)
print(len(T) - max(score_list))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ans = 10000
if t in s:
    print(0)
    exit()

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

LS = len(s)
LT = len(t)
# 最長で何文字一致するか
max_match = 0
for i in range(LS - LT + 1):
    ss = s[i:i+LT]
    match = 0
    for a,b in zip(t, ss):
        if a==b:
            match += 1
            max_match = max(max_match, match)
        else:
            match = 0

print(LT - max_match)

Submission status: Wrong Answer

Solution code:
s= input()
t= input()
len_diff= len(s)- len(t)

top=0
for i in range(len_diff):
  test= s[i:len(t)+i]
  count=0
  for i in range(len(t)):
    if test[i]==t[i]:
      count+=1
  if count>top:
    top= count

print(len(t)-top)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
"""
task statement
==============

2 つの文字列 S, T が与えられます。
T が S の部分文字列となるように、S のいくつかの文字を書き換えます。
少なくとも何文字書き換える必要がありますか？
ただし、部分文字列とは連続する部分列のことを指します。例えば、xxx は yxxxy の部分文字列ですが、xxyxx の部分文字列ではありません。

io_style
-------
S
T
"""
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    S = input()
    T = input()
    size = len(T)
    ans = 10000
    for i in range(len(S) - size):
        _s = S[i:i + size]
        tmp = 0
        for j in range(size):
            if _s[j] != T[j]:
                tmp += 1
        ans = min(ans, tmp)
    print(ans)
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
result = len(t)
for i in range(len(s) - len(t) + 1):
  box = 0
  for j in range(len(t)):
    if t[j] == s[i + j]:
      box += 1
  if result > box :
    result = box
print(result)

Submission status: Wrong Answer

Solution code:
def main():
    S = str(input())
    T = str(input())
    
    ans = len(T)
    for i in range(len(S)-len(T)):
        count = 0
        for j in range(len(T)):
            if S[i+j] != T[j]:
                count += 1
        if count <= ans:
            ans = count
    
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = input()

T = input()

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
def input(): return sys.stdin.readline().rstrip()

def hantei(S,T):
    anss=0
    for i in range(len(S)):
        if S[i]!=T[i]:
            anss+=1
    return anss

def main():
    S=input()
    T=input()
    ans=10000
    for i in range(len(S)-len(T)):
        ans=min(ans,hantei(T,S[i:i+len(T)]))
    print(ans)



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

ans = 10 ** 10
for i in range(ls - lt):
    cnt = 0
    for j in range(lt):
        if S[i + j] != T[j]:
            cnt += 1
    ans = min(ans, cnt)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, Counter
from itertools import product, permutations, combinations, accumulate
from bisect import bisect_left, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor


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


def input_int():
    return int(input())


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

Submission status: Wrong Answer

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

result = float('inf')
for i in range(len(S) - len(T)):
    count = sum(x != y for x, y in zip(S[i:i+len(T)], T))
    if count < result:
        result = count
print(result)

Submission status: Wrong Answer

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):
    tcnt = 0
    for j in range(m):
        if s[i+j] != t[j]:
            tcnt+=1
    ans = min(ans, tcnt)
print(ans)

Submission status: Wrong Answer

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

slen = len(S)
tlen = len(T)

maxnum = -1
for i in range(0, slen-tlen):
    match = 0
    for j in range(tlen):
        if S[i+j] == T[j]:
            match += 1
    if maxnum < match:
        maxnum = match

print(tlen - maxnum)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

m = 0
for i in range(len(S) - len(T)):
    res = 0
    for a, b in zip(T, S[i:i + len(T)]):
        if a == b:
            res += 1
    if res > m:
        m = res

print(len(T) - m)

Submission status: Wrong Answer

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(s[i:i + n])
    print(n - ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S=str(input())
T=str(input())
ls=len(S)
lt=len(T)
m=0
for i in range(ls):
  A=S[i:lt]
  a=0
  for s,t in zip(A,T):
    if s==t:
      a+=1
  m=max(m,a)
print(lt-m)

Submission status: Wrong Answer

Solution code:
import math
import itertools
import sys
s = input()
t = input()
cnt = len(t)
for i in range(len(s)-len(t)):
    tmp = s[i:len(t)+i]
    tcnt = 0
    for j in range(len(tmp)):
        if(tmp[j] != t[j]):
            tcnt += 1
    cnt = min(cnt, tcnt)
print(cnt)

Submission status: Wrong Answer

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

size = len(T)
n = len(S)
ans = size

for i in range(n-size):
    t = S[i:i+size]
    v = sum([k!=j for k, j in zip(T, t)])
    ans = min(v, ans)

print(ans)