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

Submission status: Wrong Answer

Solution code:
#[int(i) for i in input().split()]
def diff(x,y):
	ret = 0
	for i in range(len(x)):
		if x[i]!=y[i]:
			ret+=1
	return ret
s=input()
t=input()

l = len(t)
ans = float('inf')
for i in range(len(s)-l):
	if i+l<len(s):
		tmp = diff(s[i:i+l], t)
		ans = min(ans, tmp)
		
print(ans)

Submission status: Wrong Answer

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

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

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):
    sk = s[i:i+tn]
    count = 0
    for j in range(tn):
        if sk[j] != t[j]:
            count += 1

    if count < answer:
        answer = count

print(answer)

Submission status: Wrong Answer

Solution code:
from math import inf

S = input()
T = input()

best = inf
for i in range(len(S)):
    if i + len(T) < len(S):
        diff = sum(1 for x, y in zip(S[i : i + len(T)], T) if x != y)
        best = min(diff, best)
print(best)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

res = 10**10

for n in range(len(s)-len(t)):
    id = n
    ct = 0
    for k in range(len(t)):
        a = t[k]
        b = s[id]
        if a != b:
            ct += 1
        id += 1
    res = min(res, ct)

print(res)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import bisect
import sys,io
import math
from collections import deque
from heapq import heappush, heappop

#input = sys.stdin.buffer.readline

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7
#DIV = 998244353

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac = fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV

    return CONV()


def cumsum(As):
    s = 0
    for a in As:
        s += a
        yield s


sys.setrecursionlimit(200005)


def dijkstra(G,start=0):
    heap = []
    cost = [INF]*len(G)
    heappush(heap,(0,start))
    while len(heap)!=0:
        c,n = heappop(heap)
        if cost[n] !=INF:
            continue
        cost[n]=c
        for e in G[n]:
            ec,v = e
            if cost[v]!=INF:
                continue
            heappush(heap,(ec+c,v))
    return cost


def main():
    S= sRaw()
    T =sRaw()
    ans = 10*10
    for sidx in range(0,len(S)-len(T)+1):
        score = sum([1 for idx in range(len(T)) if S[sidx+idx]!=T[idx]])
        ans=min(score,ans)
    print(ans)

main()

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
def diff_count(A,B):
    diff = 0
    for a,b in zip(A,B):
        if a!=b:
            diff += 1
    return diff
ans = len(T)
for i in range(len(S) - len(T)):
    temp = S[i:i+len(T)]
    diff_num = diff_count(T,temp)
    ans = min(diff_num,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ans = 1000
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()
ans = float('inf')

for i in range(0, len(S) - len(T)):
    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: Wrong Answer

Solution code:
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)
print(m)

Submission status: Wrong Answer

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):
        cnt=0
        for j in range(m):
            if(a[i+j]!=b[j]):
                cnt+=1
        mn=min(mn,cnt)
    print(mn)

Submission status: Wrong Answer

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

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

ans = 0

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

print(t - c)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
ans = 1001
for i in range(len(S)-len(T)):
  num = 0
  for j in range(len(T)):
    if S[j+i] != T[j]:
      num += 1
  if num <= ans:
    ans = num
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ans = 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
    ans = max(ans,a)
print(len(t)-ans)

Submission status: Wrong Answer

Solution code:
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mat = lambda x, y, v: [[v]*y for _ in range(x)]
ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)]
mod = 1000000007
sys.setrecursionlimit(1000000)

S = rs()
T = rs()

ans = len(T)
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:
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 = input()
T = input()

ans = len(T)
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:
def readinput():
    s=input()
    t=input()
    return s,t

def main(s,t):
    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
        ans=min(ans,count)
    return ans

if __name__=='__main__':
    s,t=readinput()
    ans=main(s,t)
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    S = SI()
    T = SI()
    ls, lt = len(S), len(T)
    ans = 1100
    for i in range(ls-lt):
        tmp = 0
        tS = S[i:i+lt]
        for k, t in zip(tS, T):
            if k != t:
                tmp += 1
        ans = min(ans, tmp)
    print(ans)




if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

print(len(t) - ans)

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
g = len(s)
h = len(t)
ans = 10000
for i in range(g-h):
  k = 0
  for j in  range(h):
    if(s[i+j]!=t[j]):
      k += 1
  ans = min(ans,k)
print(ans)

Submission status: Wrong Answer

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

anses = []
for i in range(len(s) - len(t)):
  cnt = 0
  for c, d in zip(s[i:i + len(t)], t):
    if c != d:
      cnt += 1
  anses.append(cnt)

if len(anses) == 0:
  print(0)
else:
  print(min(anses))

Submission status: Wrong Answer

Solution code:
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

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

S = input()
T = input()

a = len(longestSubstringFinder(S, T))
print(len(T)-a)

Submission status: Wrong Answer

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

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

def solve(s, t):
    res = 0
    for i in range(len(s)):
        if s[i] == t[i]:
            continue
        res += 1
    return res

ans = m
for i in range(n - m):
    ans = min(ans, solve(S[i:i+m], T))
print(ans)

Submission status: Wrong Answer

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

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

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

print(len(T)-count)

Submission status: Wrong Answer

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

        if ans > temp:
            ans = temp
    
    print(ans)
main()

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
ans = -1
for i in range(0,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(len(T) - ans)

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]
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=1000000
for i in range(len(S)-len(T)):
  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:
s = input()
t = input()

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

ans = len_t

for i in range(len_s - len_t):
  u = s[i: i+len_t]
  d = sum(0 if c1 == c2 else 1 for c1, c2 in zip(t, u))
  ans = min(d, ans)

print(ans)

Submission status: Wrong Answer

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

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

print(cnt_min)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
def main():
    S = input().rstrip()
    T = input().rstrip()
    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)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
n, m = len(s), len(t)

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

print(m - ans)

Submission status: Wrong Answer

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

lendif = len(s) - len(t)

min_global = len(s)

for i in range(lendif):
  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: Wrong Answer

Solution code:
import sys
import itertools
tokens = itertools.chain.from_iterable(map(str.split, sys.stdin))

s = next(tokens)
t = next(tokens)

mn = 999999
for i in range(len(s) - len(t)):
    ss = s[i:i+len(t)]
    sm = sum(1 if a != b else 0 for a, b in zip(ss, t))
    #print(ss, t, sm)
    mn = min(mn, sm)
print(mn)

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
    if ans>tmp:
        ans=tmp
print(ans)

Submission status: Wrong Answer

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)

# i = 0
# for s in S:
#     if s == T[i]:

Submission status: Wrong Answer

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

print (len(T)-len(longestSubstringFinder(S,T)))

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=INFI
    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:
# coding: utf-8
from functools import reduce
from queue import Queue
from collections import deque

s = input()
t = input()

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

print(saisho_kyori)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 10000
for si in range(len(S)-len(T)):
    ic = 0
    for ti in range(len(T)):
        if S[si+ti] != T[ti]:
            ic += 1
    ans = min(ic, ans)
        
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):
    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()

l1 = len(S)
l = len(T)

min_= float('inf')
for i in range(l1 - l):
    cnt = 0
    for j in range(l):
        if S[i + j] != T[j]:
            cnt += 1

    min_ = min(min_, cnt)


print(min_)

Submission status: Wrong Answer

Solution code:
S = input().rstrip()
T = input().rstrip()
res = float("inf")
for i in range(len(S)-len(T)):
    t = 0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            t += 1
    res = min(t,res)
print(res)

Submission status: Wrong Answer

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

ans = float("INF")
for i in range(len(s)-len(t)):
    x = len(t)
    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()

res = 0
for i in range(len(S)-len(T)):
  a = 0
  for j in range(len(T)):
    a += S[i+j] == T[j]
  res = max(res,a)
  
print(len(T)-res)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ans = len(s)+1
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:
import sys

def main():
    S = sys.stdin.readline().rstrip()
    T = sys.stdin.readline().rstrip()

    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)


main()

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
ls = len(S)
lt = len(T)
ans = lt
for offset in range(ls - lt + 1):
	cnt = 0
	for i in range(lt):
		if S[offset + i] != T[i]:
			cnt += 1
	ans = min(lt, cnt)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

    print(min_change)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
s =input()
t = input()
len_s = len(s)
len_t = len(t)
ans = 10**10
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(cnt,ans)
print(ans)

Submission status: Wrong Answer

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

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

ans = 10**9

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

        print(S[i + j], T[j])

    ans = min(ans, tmp)

print(ans)

Submission status: Wrong Answer

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

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

Solution code:
S = input()
T = input()
L,l = len(S),len(T)
ans = 1000
for i in range(l,L):
    s = S[i-l:i]
    cnt = 0
    for j in range(l):
        if s[j] != T[j]:
            cnt += 1
    if ans > cnt:
        ans = cnt
print(ans)

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[+j] != t[j]:
      a+=1
  ans = min(a,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
n = len(s)
k = len(t)
ans = float("Inf")
for i in range(n-k):
    p = 0
    for j in range(k):
        if s[i+j] != t[j]:
            p += 1
            
    ans = min(ans, p)
    
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):
    t = S[i:i+size]
    v = sum([i!=j for i, j in zip(T, t)])
    ans = min(v, ans)

print(ans)

Submission status: Wrong Answer

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)
    cnt = 0
    for i in range(n-m):
        tmp = 0
        for j in range(m):
            if S[i+j] == T[j]:
                tmp += 1
        cnt = max(cnt, tmp)
    
    print(m - cnt)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ls = len(s)
lt = len(t)
ans = float('inf')
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:
s=input()
t=input()
n=len(t)
ans=len(t)

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

Submission status: Wrong Answer

Solution code:
s, t = list(input()), list(input())
ans = 10**10
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(ans, tmp)
print(ans)

Submission status: Wrong Answer

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

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 = len(T)
for i in range(len(S) - len(T)):
    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: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

ans = 1000

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

Submission status: Wrong Answer

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

result = 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
    result = min(result, c)
print(result)

Submission status: Wrong Answer

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

    len_s = len(s)
    len_t = len(t)
    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 = input()
t = input()

ans = len(t)

for i in range(len(s)):
  si = s[i:]
  cnt = 0
  if len(si) == len(t):
    for sii, ti in zip(si, t):
      if sii != ti:
        cnt += 1
    ans = min(ans, cnt)
print(ans)