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:
#!/usr/bin/env python3
def main():
    S = input()
    T = input()

    ans = 10 ** 6
    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)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
find = False
minimum = 0
for i in range(len(S)):
    if find == True:
        break
    m = 0
    for j in range(len(T)):
        try:
            if S[i+j] != T[j]:
                m += 1
        except IndexError:
            print(minimum)
            find = True
            break
    if m == 0:
        print(minimum)
    else:
        if minimum == 0:
            minimum = m
        elif minimum >= m:
            minimum = m
        else:
            pass

Submission status: Wrong Answer

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


max_diff = 0
window = len(T)
for i in range(0, len(S) - window + 1):
    x = S[i: i+window]
    count = 0
    for a, b in zip(T, x):
        if a != b:
            count += 1
    max_diff = max(count, max_diff)
print(max_diff)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#B
S = input()
T = input()
def counter(A,B):
    tmp = 0
    for j in range(len(A)):
        if A[j]==B[j]:
            tmp += 1
    return tmp
result = 0
for i in range(len(S)-len(T)):
    kaburi = counter(S[i:i+len(T)],T)
    if kaburi > result:
        result = kaburi
print(len(T)-result)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re
import math


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    S1 = S()
    T = S()

    ans = float("inf")

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

s = [_ for _ in input()]
t = [_ for _ in input()]

ans = 10**10

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
m = 0
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 c > m:
        m = c
        ans = len(t) - c

print(ans)

Submission status: Wrong Answer

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

def main():
    s = input()
    t = input()
    m = len(s)
    n = len(t)

    c_max = 0
    for i in range(m-n):
        cnt = 0
        for j in range(n):
            if s[i+j] == t[j]:
                cnt += 1
        if cnt > c_max:
            c_max = cnt

    print(n - c_max)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if T in S:
    print(0)
else:
    matched = 0
    for i in range(len(S)-len(T)):
        matched_work = 0
        for j in range(len(T)):
            if T[j] == S[i+j]:
                matched_work += 1
        if matched_work > matched:
            matched = matched_work
    print(len(T)-matched)

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
n=len(s);k=len(t)
an=k
for i in range(n-k-1):
  a=s[i:i+k]
  ct=0
  for j in range(k):
    if a[j]!=t[j]:
      ct+=1
  an=min(an,ct)
print(an)

Submission status: Wrong Answer

Solution code:
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    S_ = S()
    T = S()
    a = len(S_)
    b = len(T)
    cnt_list = []
    for i in range(a - b):
        cnt = 0
        S_1 = S_[i:i + b + 1]
        for i in range(b):
            if S_1[i] == T[i]:
                cnt += 1
        cnt_list.append(cnt)

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

Submission status: Wrong Answer

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

Min = len(T) + 1

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

print(count)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

# from typing import Optional
# from typing import List
# from typing import Dict
# from typing import Tuple
# from typing import Sequence


def main():
    S = input()
    T = input()

    S_ary = list(S)
    T_ary = list(T)

    diff = len(S_ary) - len(T_ary)
    tLen = len(T_ary)

    minCounter = 1000
    for i in range(diff):
        tempS = S_ary[i : i + tLen]

        counter = 0
        for charIndex in range(tLen):
            if tempS[charIndex] != T_ary[charIndex]:
                counter += 1
        minCounter = min(minCounter, counter)

    print(minCounter)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")
import sys,collections

S = sys.stdin.readline().rstrip()
T = sys.stdin.readline().rstrip()
SN = len(S)
TN = len(T)
m = 0

for i in range(SN-TN):
    t = 0
    for j in range(TN):
        if T[j]==S[i+j]:
            t += 1
    m = max(m,t)
print(TN-m)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    S = input().strip()
    T = input().strip()

    res = len(T)
    for i in range(len(S) - len(T)):
        res = min(res, sum(1 if s != t else 0 for s, t in zip(S[i:], T)))

    print(res)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

print(c)

Submission status: Wrong Answer

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

answer = 100000
for i in range(len(S) - len(T)):
    distance = 0
    for j in range(len(T)):
        if S[i + j] != T[j]:
            distance += 1
    if answer > distance:
        answer = distance
print(answer)

Submission status: Wrong Answer

Solution code:
import numpy as np
from copy import deepcopy
from heapq import heappop, heappush
from bisect import bisect_left, bisect
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations

S = input()
T = input()

replaced = T.replace(S, '')
print(len(T) - len(replaced))

exit()

Submission status: Wrong Answer

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

for i in range(len(T)):
    if not (T[0:i] in S):
        break

print(len(T) - i)

Submission status: Wrong Answer

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

def main():
    s = list( input() )
    t = list( input() )
    len_s = len(s)
    len_t = len( t )
    max = 0
    for i in range( len_s - len_t + 1 ):
        sub_s = s[ i : i + len_t ]
        same = 0
        for j , sub_j in enumerate(sub_s):
            if sub_j == t[j]:
                same += 1
        if same > max:
            max = same
    
    print( len_t - max )

main()

Submission status: Wrong Answer

Solution code:
s,t=open(0).read().split()
res=1001
for i in range(len(s)):
  cnt=0
  for j in range(len(t)):
    if i+j<len(s):
      if s[i+j]==t[j]:
        cnt+=1
  res=min(len(t)-cnt,res)
print(res)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
sl = len(s)
tl = len(t)
ans = 10**5
for i in range(sl-tl):
  tmp = s[i:i+tl]
  pen = 0
  for j,k in enumerate(tmp):
    if t[j]!=k: pen += 1
  ans = min(ans,pen)
print(ans)

Submission status: Wrong Answer

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

myans = float('INF')
for s in range(len(S) - len(T) ):
    mycnt = 0
    for t in range(len(T)):
        #print(S[s+t], T[t])
        if S[s+t] != T[t]:
            mycnt += 1
    if mycnt < myans:
        myans = mycnt
print(myans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

d = len(s) - len(t)
min_c = int(1e4)
for i in range(d):
    st = s[i:i+len(t)]
    c = 0
    for j in range(len(t)):
        if st[j] != t[j]:
            c += 1
            if c > min_c:
                break
    min_c = min(c, min_c)

print(min_c)

Submission status: Wrong Answer

Solution code:
# import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))

# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))


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

    max_l = 0
    for i, sa in enumerate(s):
        tl = 0
        for j, ta in enumerate(t):
            if i + j >= len(s):
                tl = 0
                break
            if s[i+j] == ta:
                tl += 1
            else:
                break
        max_l = max(max_l, tl)

    return len(t) - max_l


def main():
    print(solve())


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

r=len(t)
for ii in range(len(s)-len(t)+1):
  rr=0
  for jj in range(len(t)):
    if s[ii+jj]!=t[jj]:
      rr+=1
  if rr<r:
    r=rr
print(rr)

Submission status: Wrong Answer

Solution code:
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    S, T = sys.stdin.read().split()

    ls, lt = len(S), len(T)
    ans = lt
    for i in range(ls - lt):
        x = 0
        for j in range(lt):
            if S[i+j] == T[j]:
                continue
            x += 1
            if x > ans:
                break
        else:
            if x < ans:
                ans = x

    print(ans)

if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
# 入力
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 (ans > count):
        ans = count

print(ans)

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:]
  count=0
  for j in range(len(t)):
    if test[j]==t[j]:
      count+=1
  if count>top:
    top= count

print(len(t)-top)

Submission status: Wrong Answer

Solution code:
import sys
from sys import exit
from math import gcd, factorial, ceil, floor, sqrt
from bisect import bisect_left, bisect_right
from copy import deepcopy
from heapq import heapify, heappop, heappush
from itertools import permutations, combinations, product, accumulate
from collections import defaultdict, deque, Counter
sys.setrecursionlimit(10**7)

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

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

Submission status: Wrong Answer

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

ans = len(S)
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:
s = input() # all
t = input() # substring

def calc_length(str1, str2):
    length = 0
    for i in range(len(str1)):
        if str1[i] != str2[i]:
            length += 1
    return length

min_length = len(t)
for i in range(len(s)- len(t)):
    l = calc_length(s[i:i+len(t)], t)
    if l < min_length:
        min_length = l

print(min_length)

Submission status: Wrong Answer

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

print(len(T)-cnt)

Submission status: Wrong Answer

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


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


i = 0
len_t = len(T)
ans = 10**10
while i+len_t < len(S)-1:
    s_bubun = S[i:i+len_t]
    kouho = count_diff(s_bubun, T)
    ans = min(kouho, ans)
    i += 1

print(ans) if ans != 10**10 else print(0)

Submission status: Wrong Answer

Solution code:
def main():
    s = input()
    t = input()
    length = len(t)
    mn = 9999
    for i in range(len(s) - length):
        counter = 0
        temp = s[i:i+length]
        for j,c in enumerate(temp):
            if t[j] != c:
                counter += 1
        mn = min(mn,counter)
    print(mn)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log  # log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint


def ceil(a, b): return (a + b - 1) // b


inf = float('inf')
mod = 10 ** 9 + 7


def pprint(*A):
    for a in A:     print(*a, sep='\n')


def INT_(n): return int(n) - 1


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


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [I() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


def I(): return int(input())


def F(): return float(input())


def ST(): return input().replace('\n', '')


def main():
    S = ST()
    T = ST()
    m = 0
    for i in range(len(S)-len(T)):
        mn = 0
        for j in range(len(T)):
            if S[i+j] == T[j]:
                mn += 1
        m = max(m, mn)
    print(len(T) - m)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def dif (s,t):
    ans=0
    for i in range(len(s)):
        if s[i]!=t[i]:
            ans+=1
    return ans
s=input()
t=input()
k=len(t)
ans=99999999999999999
for i in range(len(s)-k):
    a=s[i:i+k]
    b=dif(a,t)
    ans=min(ans,b)
print (ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

nS=len(S)
nT=len(T)

N=nS-nT+1
dfmin=1000
for i in range(N):
    df=0
    for j in range(nT):
        if S[i+j]!=T[j]:
            df+=1
    if df < dfmin:
        dfmin=df
print(df)

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)):
  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)
if len(score_list) > 0:
  print(len(T) - max(score_list))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

import math
import re
import numpy as np
import copy

#読み込む
S = input()
T = input()

ans = len(S)

#高々(10^3)^2

for i in range(len(S) - len(T)):
    #何文字違うかをチェック
    cnt = 0
    for j in range(len(T)):
        if T[j] != S[i+j]:
            cnt += 1

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
max = 0
a = 0
for cs in s:
  for ct in t:
    if cs == ct:
      a += 1
      if max < a:
        max = a
    else:
      a = 0
print(len(t) - max)

Submission status: Wrong Answer

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

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

    if len_s == len_t:
        ans = 0
        for i in range(len_s):
            if s[i] != s[i]:
                ans += 1
        print(ans)
    else:
        ans = 1001
        for i in range(len_s - len_t):
            cnt = 0
            for j in range(len_t):
                if s[i + j] != t[j]:
                    cnt += 1
            if cnt < ans:
                ans = cnt
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
s=list(str(input()))
t=list(str(input()))
ch=len(t)
for i in range(len(s)-len(t)):
    temp=0
    for j in range(len(t)):
        if(s[i+j]!=t[j]):
            temp+=1
    if(temp<ch):
        ch=temp
print(ch)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)

#a = int(input())
#b = list(map(int, input().split()))
#n, m = map(int, input().split())
s = input()
t = input()
#s,t = input().split()
#a = [int(input()) for _ in range(n)]
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

s = [ch for ch in s]
t = [ch for ch in t]

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

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
mx = 0
for i in range(len(S) - len(T)):
    t = 0
    for j in range(len(T)):
        if i + j < len(S) and S[i + j] == T[j]:
            t += 1
    mx = max(mx, t)
print(len(T) - mx)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

s = readline().decode().rstrip()
t = readline().decode().rstrip()
ans = 0
for i in range(len(t)-1):
    if t in s:
        break
    else:
        t = t[:-1]
        ans +=1

print(ans)

Submission status: Wrong Answer

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

res = 10**6
for i in range(len(s)-len(t)):
    val = 0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            val += 1
    res = min(res, val)
print(res)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = len(t)
tmp = ''
for i in t:
    tmp += i
    if tmp in s:
        ans = min(ans, len(t)-len(tmp))

s = s[::-1]
t = t[::-1]
tmp = ''
for i in t:
    tmp += i
    if tmp in s:
        ans = min(ans, len(t)-len(tmp))

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
u=m=len(t)
for i in range(len(s)-u):
	m=min(m,sum([1 for j in range(u) if s[i+j]!=t[j]]))
print(m)

Submission status: Wrong Answer

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

    ans = 10**4
    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 ans > count :
            ans = count 

    if ans == 10**4:
        print(len(T))
    else:
        print(ans)
        
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

min_count = 1000
for idx in range(0, len(S) - len(T)):
    s = S[idx:idx+len(T)]
    count = sum([1 if tc!=sc else 0 for tc, sc in zip(T, s)])
    min_count = min(min_count, count)

print(min_count)

Submission status: Wrong Answer

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

minnum = 1000
i = 0
while i < len(S)-len(T):
  num = 0
  j = 0
  
  while j < len(T):
    if S[i+j] != T[j]:
      num += 1
    j += 1
  
  if minnum > num:
    minnum = num
  i += 1

print(minnum)

Submission status: Wrong Answer

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

for i in range(len(S)-len(T)+1):
    ans = 10000
    count = 0
    for elts, eltt in zip(S[i:i+len(T)], T):
        if elts != eltt:
            count += 1
    ans = min(ans, count)

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

S = list(input())
T = list(input())

lens = len(S)
lent = len(T)
maxcnt = 0
for i in range(lens-lent+1):
    cnt = 0
    tmp_cnt = 0
    for j in range(lent):
        if S[i+j]==T[j]:
            tmp_cnt += 1
        else:
            cnt = max(cnt, tmp_cnt)
            tmp_cnt = 0
    cnt = max(cnt, tmp_cnt)
    maxcnt = max(maxcnt, cnt)
print(lent-maxcnt)

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)):
        if S[i+j]==T[j]:
            continue
        else:
            tmp+=1
    ans=min(ans,tmp)
print(ans)

Submission status: Wrong Answer

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

def c(s, t):
  print(s)
  r = 0
  for i in range(n):
    if s[i] == t[i]:
      r += 1
  return n - r

ans = n
for i in range( len(S) - n + 1):
  temp = c(S[i:i+n],T)
  ans = min( ans, temp)

print(ans)

Submission status: Wrong Answer

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

ans = 1000

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

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
if t in s:
  print("0")
else:
  mindif = 1000
  for i in range(len(s)-len(t)):
    ss = s[i:i+len(t)]
    difs = 0
    for j in range(len(t)):
      if ss[j] != t[j]:
        difs += 1
    mindif = min(mindif,difs)
  print(mindif)

Submission status: Wrong Answer

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

mx = -1
for i in range(len(S) - l):
    m = [a == b for a, b in zip(S[i:i + l], T)].count(True)
    mx = max(m, mx)

print(l - mx)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

import sys


INF = sys.maxsize // 10


def minimize(s, t):
    ns = len(s)
    nt = len(t)
    res = INF
    for start_idx in range(ns - nt):
        cand = sum(c != d for c, d in zip(s[start_idx: start_idx + nt], t))
        res = min(res, cand)
    return res


def main():
    s = input()
    t = input()
    print(minimize(s, t))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(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:
S = input()
T = input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

min_count = len(T)
for i in range(len(S) - len(T)):

    count = 0
    for x in range(len(T)):
        if S[i+x] != T[x]:
            count += 1

    if count < min_count:
        min_count = count

print(min_count)

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
n=len(t)
for i in range(n+1,-1,-1):
  for j in range(n-i+1):
    if t[j:j+i] in s[j:]:
      print(n-i)
      exit()

Submission status: Wrong Answer

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

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

len_s, len_t = len(S), len(T)
ans = len_t + 1
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
    if tmp < len_t:
        ans = tmp
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase
#from bisect import bisect_left as bl                #c++ lowerbound bl(array,element)
#from bisect import bisect_right as br               #c++ upperbound br(array,element)
 
 
def main():
    s=input()
    t=input()
    n=len(s)
    m=len(t)
    ans=m
    for x in range(n-m):
        count=0
        cc=0
        for y in range(x,x+m):
            if s[y]!=t[cc]:
                count+=1
            cc+=1
        ans=min(count,ans)
    print(ans)


#-----------------------------BOSS-------------------------------------!
# region fastio

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

# endregion

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
input=lambda : stdin.readline().strip()
from math import ceil,sqrt,factorial,gcd
from collections import deque
from bisect import bisect_left,bisect_right
s=input()
t=input()
m=float("infinity")
for i in range(len(s)):
	count=0
	if i+len(t)<len(s):
		for j in range(len(t)):
			if t[j]!=s[i+j]:
				count+=1
		m=min(m,count)
if t in s:
	m=0
print(m)