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()
l = len(t)

for i in range(l):
    if t[i:l] in s:
        a = i
        break
else:
    a = l

for j in range(1, l):
    if t[0:l-j] in s:
        b = j
        break
else:
    b = l

print(min(a, b))

Submission status: Wrong Answer

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

max_match=0
match=0
for idx in range(len(S)-len(T)):
    for j in range(len(T)):
        if(S[idx]==T[j]):
            match+=1
        else:
            if(match>max_match):
                max_match=match
            match=0

print(len(T)-max_match)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
ans = 0
for i in range(len(S) - len(T) + 1):
  part = S[i:i+len(T)]
  cnt = 0
  for p, t in zip(part, T):
    if p == t:
      cnt = cnt + 1
  if ans < cnt:
    ans = cnt
print(len(T) - cnt)

Submission status: Wrong Answer

Solution code:
def main():
  S = input("")
  T = input("")
  
  length = len(T)
  S_sub_T = len(S) - length

  max_match = 0
  S_offset = 0
  for i in range(S_sub_T):
    match = 0
    for j in range(length):
      if(S[i + j] == T[j]):
        match += 1
    if(max_match < match):
      max_match = match
  
  need_replace = length - max_match
  print(need_replace)
 
if __name__ == "__main__":
  main()

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
    print(t,s[i:len(t)+i],u)    
    ans=max(ans,u)  
if len(s)==len(t):
    for a,b in zip(t,s):
        if a==b:ans+=1    
print(len(t)-ans)

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
ans=10*3+1
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()

len_S = len(S)
len_T = len(T)

ans = 10*5
for i in range(len_S - len_T+1):
    num = 0
    tmp = S[i:i+len_T]
    print(tmp)
    for j in range(len(tmp)):
        print(tmp[j])
        if tmp[j] != T[j]:
            num+=1
    ans = min(ans, num)

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
a = 0
t = len(T)
for i in range(len(T)):
  if T[:i+1] not in S:
    break
  a += 1
print(t-a)

Submission status: Wrong Answer

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

ans = len(T)

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

print(ans)

Submission status: Wrong Answer

Solution code:
#coding: utf-8

S = input()
T = input()

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

print(len(T) - match)

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)

    if len(S) == len(T) and S != T:
        min_change = len(T)

    print(min_change)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if t in s:
    print(0)
    exit()

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]

ans1 = len(t)

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

print(min(ans, ans1))

Submission status: Wrong Answer

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

i = 0
j = len(s2)
m = j

while j < len(s1):
  c = 0
  for k in range(len(s2)):
    if s2[k] == s1[k+i]:
      c+=1
  j += 1
  i += 1
  m = min(m, len(s2)-c)

Submission status: Wrong Answer

Solution code:
ss = str(input())
tt = str(input())
#print(ss,tt)
maxlength = 0
for i in range(len(tt)):
    for j in range(i+1,len(tt)+1):
#        print(i,j,tt[i:j])
        if tt[i:j] in ss[i:]:
            if maxlength < len(tt[i:j]):
                maxlength = len(tt[i:j])

print(len(tt)-maxlength)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
num_S = len(S)
num_T = len(T)
match = 0

for i in range(num_S - num_T):
    count = 0
    for j in range(num_T):
        if S[i+j] == T[j]:
            count += 1
    if count > match:
        match = count

print(num_T - match)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
S = str(input())
T = str(input())

len_S = len(S)
S_part_dict = {}
for i in range(len_S):
    for j in range(i, len_S):
        S_part_dict[S[i:j + 1]] = i

max_part_len = 0
for part_str, len_from_top in S_part_dict.items():
    now_len_part = len(part_str)
    if now_len_part <= max_part_len:
        continue
    if T[len_from_top:].count(part_str):
        max_part = now_len_part

print(len(T) - now_len_part)

Submission status: Wrong Answer

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

S_list = list(S)
T_list = list(T)

t_cnt = 0
t_cnt_max = 0
start_pos = 0

#print(S_list, T_list)

for i in range(len(S_list) - len(T_list)):
    t_cnt = 0
    for j in range(len(T_list)):   
        if S_list[i+j] == T_list[j]:
            t_cnt += 1
            start_pos = i
            if t_cnt_max < t_cnt:
                t_cnt_max = t_cnt
print(len(T_list) - t_cnt_max)

Submission status: Wrong Answer

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

l = len(t)
flag = 0
for i in range(1, l+1):
    if flag == 1:
        break
    for j in range(i):
        if t[j:j+(l-i)+1] in s[j:len(s)-(i-j-1)]:
            flag = 1
            print(i-1)
            break

if flag == 0:
    print(l)

Submission status: Wrong Answer

Solution code:
##全探索...?
S = input()
T = input()

last = len(S) - len(T) + 1
ans = len(T)

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

Submission status: Wrong Answer

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

ans = 0
if t in s:
    print(0)
else:
    for i in range(1,len(t)):
        ans = i
        if t[:-i] in s or t[i:] in s:
            break
print(ans)

Submission status: Wrong Answer

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

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

answer = len(T) - max_count
print(answer)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
import numpy as np

s = input().strip()
t = input().strip()

if t in s:
    print(0)

else:
    l = len(t)
    c=False
    for i in range(l):
        if t[i+1:] in s[(i+1):]:
            print(i+1)
            c = True
            break
        elif t[:-(i+1)] in s[:-(i+1)]:
            print(i+1)
            c = True
            break
        else:
            pass

    if not c:
        print(l)

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

Submission status: Wrong Answer

Solution code:
import numpy as np

S=input()
T=input()

length = len(list(T))

max_score = 0
for i in range(len(list(S))-len(list(T))):
    tmp_T = np.array(list(T))
    tmp_S = np.array(list(S))[i:i+len(tmp_T)]
    score = np.zeros(len(tmp_T))
    score[tmp_T==tmp_S]=1
    score = np.sum(score)
    if max_score < score:
        max_score=score
print(int(length-max_score))

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ans = 0
max = 0

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

print(len(t) - max)

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
len_s=len(s)
len_t=len(t)
len_n=len_s-len_t
ans=100000
for i in range(0,len_n):
    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()

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

def f(s1,s2):
  r=0
  for i,j in zip(s1,s2):
    if i != j: r += 1
  return r

a=len(S)
for i in range(len(S)-len(T)):
  r = f(S[i:i+len(T)],T)
  if a > r: a = r

print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 0
for i in range(len(t)):
    if t[1:(i+1)] in s:
        ans = i+1

print(len(t) - ans)

Submission status: Wrong Answer

Solution code:
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()
print(len(t)-len(longestSubstringFinder(s,t)))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
#B
s = input()
t = input()
Min = len(t)

for i in range(len(s)-len(t)):
    cont = len(t)
    for j in range(len(t)):
        if s[i+j] == t[j]:
            cont -= 1
            
    if cont < Min:
        Min = cont


print(Min)

Submission status: Wrong Answer

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

m = 0
for tt in range(len(t)):
    ttt = t[tt:]
    if ttt in s:
        # print("ok:", m)
        break
    m += 1

n = 0
for tt in range(len(t)):
    ttt = t[:len(t)-tt]
    if ttt in s:
        # print("ok:", n)
        break
    n += 1

print(min(m,n))

Submission status: Wrong Answer

Solution code:
def diff(X,Y):
    l=len(X) 
    c=0 
    for i in range(l):
        if X[i]!=Y[i]:
            c+=1 
    return c
s=input() 
t=input() 
ans=len(s) 
i=0 
for _ in range(len(s)-len(t)):
    ans=min(ans,(diff(s[_:_+len(t)],t))) 
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import math
S = str(input())
T = str(input())


d = 0
for i,o in enumerate(S):
        j = 0
        c = 0
        for l in S[i:i+len(T)]:
            if l == T[j]:
                c += 1
            j += 1
        d = max(d, c)
        if i > len(S) - len(T):
            break
print(len(T)-d)

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(m)
        break
    else:
        if minimum == 0:
            minimum = m
        elif minimum >= m:
            minimum = m
        else:
            pass

Submission status: Wrong Answer

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

res = len(T)
for i in range(len(S)-len(T)):
  target = S[i:i+len(T)]

  matchCount = 0
  for s, t in zip(T, target):
    if s == t:
      matchCount += 1
  res = min(res, len(T)-matchCount)

print(res)

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
a=0
for i in range(len(t)):
  if s.count('t[i]')==0:
    a+=1
print(a)

Submission status: Wrong Answer

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

t1 = T
t2 = ''.join(list(reversed(T)))
ans1 = 10**9
ans2 = 10**9
for i in range(1, len(T)):
  st1 = t1[0:i]
  st2 = ''.join(list(reversed(t2[0:i])))
  #print(st1, st2)
  if st1 in S:
    ans1 = len(T)-i
  if st2 in S:
    ans2 = len(T)-i
    
print(min(ans1, ans2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def resolve():
	S = list(input())
	T = list(input())
	lenT = len(T)
	res = lenT
	for i in range(len(S)-lenT):
		tmp = lenT
		for j in range(lenT):
			if S[i+j] == T[j]:
				tmp -= 1
		res = min(res, tmp)
	print(res)
resolve()

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
if t in s:
  print(0)
else:
  for i in range(len(t)-1):
    i += 1
    t1 = t[:i]
    t2 = t[i:]
    if t2 in s:
      print(i)
      break
    i *= -1
    t3 = t[i:]
    t4 = t[:i]
    if t4 in s:
      print(i*-1)
      break

Submission status: Wrong Answer

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

cnt = 0
for i in range(len(S)):
    tmp = 0
    for j in range(len(T)):
        if i + j < len(S) and S[i + j] == T[j]:
            tmp += 1
        else:
            cnt = max(cnt, tmp)
            tmp = 0

print(len(T) - cnt)

Submission status: Wrong Answer

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

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

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, len_t - cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
X = input().strip()
Y = input().strip()

res = float("inf")
for i in range(len(X)-len(Y)):
    cnt =0
    for j in range(len(Y)):
        if X[i+j]!=Y[j]:cnt+=1
    res = min(res,cnt)
print(res)

Submission status: Wrong Answer

Solution code:
import numpy as np
s = input()
t = input()
m = np.zeros(len(s),dtype=int)
for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j] and i>=j:
            for k in range(j,len(t)):
                if i+k-j >= len(s):
                    break
                elif s[i+k-j] == t[k]:
                    m[i] += 1
                else:
                    break
ans = len(t) - max(*m)
print(ans)

Submission status: Wrong Answer

Solution code:
ans = 1000
hoge = 0

s = input()
t = input()

sl = len(s)
tl = len(t)
for i in range(sl-tl):
    for j in range(tl):
        if s[i+j] != t[j]:
            hoge = hoge + 1
    if ans > hoge:
        ans = hoge
    hoge = 0

if ans == 1000:
    print("0")
else:
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#
# abc177 c
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """cabacc
abc"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """codeforces
atcoder"""
        output = """6"""
        self.assertIO(input, output)


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

    ans = float("inf")
    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(ans, tmp)

    print(tmp)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 29 20:26:17 2020

@author: wiste
"""

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


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

ans = len(T) - cm


print(ans)

Submission status: Wrong Answer

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

maxsame = 0

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ans = ''
for i in range(len(t)):
  k = len(t) - i
  if ans == '':
    for j in range(len(s) - k + 1):
      if s[j: j + k] in t and j > t.index(s[j:j + k]):
        ans = len(t) - k
        break      
print(ans)

Submission status: Wrong Answer

Solution code:
def count_diff(a, b):
    cnt = 0
    for c_a, c_b in zip(a, b):
        if c_a != c_b:
            cnt += 1
    return cnt

S = input()
T = input()

ans = float('inf')
for i in range(len(S)-len(T)):
    word = S[i:i+len(T)]
    tmp = count_diff(word, T)
    ans = min(ans, tmp)

print(ans)

Submission status: Wrong Answer

Solution code:
#ceilevenoddformula
import math
import bisect
import copy
import time
from collections import Counter
from itertools import combinations
#map(int,input().split())
#int(x) for x in input().split()
s=input()
x=input()
if x in s:
	print(0)
else:
	ans=10**9
	for i in range(len(s)-len(x)):
		c=0
		for j in range(len(x)):
			if s[i+j]!=x[j]:
				c+=1
		ans=min(ans,c)
	print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

len_s=len(s)
len_t=len(t)
d=len_t
for i in range(len_s - len_t):
    s2 = s[i:i+len_t]
#    print(s2)
    d2=0
    for j in range(len_t):
        if s2[j]!=t[j]:
            d2+=1
#    print("{}/{}".format(s2,t))
    if d2<d:
        d=d2
print(d)

Submission status: Wrong Answer

Solution code:
""" B
    https://atcoder.jp/contests/abc175/tasks/abc175_b
"""
import sys
import math
from functools import reduce
from bisect import bisect_left

def readString():
    return sys.stdin.readline()

def readInteger():
    return int(readString())

def readStringSet(n):
    return sys.stdin.readline().split(" ")[:n]

def readIntegerSet(n):
    return list(map(int, readStringSet(n)))

def readIntegerMatrix(n, m):
    return [readIntegerSet(m) for _ in range(0, n)]

def main(T, S):
    best = sys.maxsize
    for i in range(len(T)-len(S)):
        s = T[i:i+len(S)]
        count = 0
        for j in range(len(S)):
            if s[j] != S[j]:
                count += 1
        if best > count:
            best = count
    return best


if __name__ == "__main__":
    _T = readString().rstrip()
    _S = readString().rstrip()

    print(main(_T, _S))

Submission status: Wrong Answer

Solution code:
a = "abc"
print(a[0:])

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
mini = len(b)
if a == b:
  print(0)
  exit(0)
for s in range(len(a) - len(b)):
  c = 0
  for i, j in zip(a[s:s + len(b)], b):
    if i != j:
      c += 1
  mini = min([mini, c])
print(mini)

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 = 0
for i in range( len( s ) - len( t ) ):
    ans_i = compare( s[ i : i + len( t ) ], t )
    if ans_i < ans or i == 0:
        ans = ans_i

print( ans )

Submission status: Wrong Answer

Solution code:
from sys import stdin

s = stdin.readline().strip()
t = stdin.readline().strip()

def sub_str(text, len_):
  ret = []
  for i in range(len(text)-len_+1):
    ret.append((i, text[i:i+len_]))
  return ret

for i in range(len(t)):
  len_s = len(t) - i
  substr = sub_str(t, len_s)
  for j, ss in substr:
    if ss in s[j:]:
      print(i)
      exit()
      
print(len(t))

Submission status: Wrong Answer

Solution code:
import sys
s = input()
t = input()
d = 0
m = sys.maxsize
for i in range(len(s)-len(t)+1):
  c = 0
  for j in range(i,i+len(t)):
    if t[i-j]!=s[j]:
      c+=1
  m = min(m,c)
print(m)

Submission status: Wrong Answer

Solution code:
from sys import stdin
import re
from itertools import combinations


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    S = _in[0]  # type:str
    T = _in[1]  # type:str
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    ans = 0
    if T in S:
        ans = 0
    else:
        for i in range(len(T)-1):
            ans = i + 1
            index = [j for j in range(len(T))]
            comb = list(combinations(index, i+1))

            for _comb in comb:
                t = list(T)
                for _i in _comb:
                    t[_i] = r'(\w)'
                t = r''.join(t)
                if re.search(t, S):
                    break
            else:
                continue
            break
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

ans = n
for i in range(m - n):
    d = 0
    for j in range(n):
        if S[i + j] != T[j]:
            d += 1
    if ans > d:
        ans = d
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
ans = 0
fin = 0
if (T in S):
    print(0)
else:
    for i in range(len(T)):
        if fin == 1:
            break
        else:
            ans += 1
            for j in range(len(T)):        
                tmp = T[:j] + T[j+i +1:]
                if (tmp in S):
                    print(ans)
                    fin = 1
                    break

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
ans = len(T)
n1 = len(S)-len(T)
for i in range(n1):
    ans2 = 0
    for k in range(len(T)):
        # print(S[k+1],T[k])
        if S[k+i] != T[k]:
            ans2 += 1
    
    ans = min([ans,ans2])
    # print(ans)
print(ans)

Submission status: Wrong Answer

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

a = 0
ans = len(T)
c = len(T)


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

Submission status: Wrong Answer

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

c_min=len(t)

for i in range(len(s)+1-len(t)):
    count=len(t)
    for n in range(len(t)):
        if s[i+n] == t[n]:
            count -=1
        elif s[i+n] != t[n]:
            break
    if count < c_min:
        c_min =count
        
s_r=s[::-1]
t_r=t[::-1]
for i in range(len(s)+1-len(t)):
    count=len(t)
    for n in range(len(t)):
        if s_r[i+n] == t_r[n]:
            count -=1
        elif s_r[i+n] != t_r[n]:
            break
    if count < c_min:
        c_min =count
print(c_min)

Submission status: Wrong Answer

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

S= input().rstrip('\n')
T= input().rstrip('\n')
res = 0
check = 0
for x in range(len(T),0,-1):
  for i in range(len(T)-x):
    if T[i:i+x] in S[i:len(S)-(len(T)-(i+x))]:
      res += len(T)-x
      check += 1
      break
  if check>0:
    break
print(res)

Submission status: Wrong Answer

Solution code:
def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]
ans = 0

s = input()
t = input()
l = len(t)

mx = 0
for idx, _ in enumerate(s[:-l+1]):
    word = ''
    for i in range(l):
        word += s[idx+i]
    x = 0
    for a, b in zip(word, t):
        if a == b: x += 1
    if x > mx: mx = x

ans = l - mx

print(ans)

Submission status: Wrong Answer

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

ans=100000
num=len(s)-len(t)
for i in range(num):
  r=0
  for j in range(len(t)):
      
    if s[i+j]!=t[j]:
      r+=1
  if r<ans:
      ans=r
print(ans)

Submission status: Wrong Answer

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

max = 0
max_i = 0
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
    if cnt > max:
        max = cnt
        max_i = i
        ans = len(T) - max

print(ans)

Submission status: Wrong Answer

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

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

l = len(T)
for t in range(1,l):
  if (T[t:] in S) or (T[:-1*t] in S):
    ans = t
    break

print(ans)

Submission status: Wrong Answer

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

if T in S:
    print("0")
else:
    slen = len(S)
    tlen = len(T)
    ansCnt = tlen

    for i in range(slen-tlen):
        cnt = 0
        for j in range(tlen):
            if T[j]!=S[i+j]:
                cnt += 1
        
        if ansCnt>cnt:
            ansCnt = cnt

    print(ansCnt)

Submission status: Wrong Answer

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

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

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:
#B
s = input()
t = input()
Min = float("inf")

for i in range(len(s)-len(t)):
    cont = len(t)
    for j in range(len(t)):
        if s[i+j] == t[j]:
            cont -= 1
            
    if cont < Min:
        Min = cont
        
print(Min)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

    ans = min(ans, tmp)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

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

    num = len(S) - len(T)

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ans = len(t)

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

print(ans)

Submission status: Wrong Answer

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

def f(s,t):
    count = 0
    for i,j in zip(s,t):
        if i == j:
            count += 1
    return count

def F(S,T):
    len_s = len(S)
    len_t = len(T)
    max = 0
    for i in range(len_t-1,len_s):
        x = f(S[i-len_t+1:i],T)
        if x > max:
            max = x
    return len_t - max

print(F(S,T))

Submission status: Wrong Answer

Solution code:
##全探索...?
S = input()
T = input()

last = len(S) - len(T)
ans = len(T)

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

Submission status: Wrong Answer

Solution code:
s = input()
t= input()
len_t = len(t)
len_s = len(s)

ans = len_t
for i in  range(len_s - len_t):
    s_sub = s[i:len_t + i]
    ans  = min(ans, len([... for i in range(len_t) if t[i] != s_sub[i]]))
print(ans)

Submission status: Wrong Answer

Solution code:
def diff(s,t):
    assert len(s) == len(t)
    c = 0
    for i,j in zip(s,t):
        if i != j:
            c+=1
        else:
            pass
    return c
s=input()
t=input()
n=len(s)
m=len(t)
min_=10**5
for i in range(n-m):
    min_=min(min_,diff(s[i:m+i],t))
print(min_)

Submission status: Wrong Answer

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

cost = 10**9+7

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

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
ans = 0
fin = 0
if (T in S):
    print(0)
else:
    for i in range(len(T)):
        if fin == 1:
            break
        else:
            ans += 1
            for j in range(len(T)):        
                tmp = T[:j] + T[j+i +1:]
                if (tmp in S):
                    print(ans)
                    fin = 1
                    break
    if ans == len(T):
        print(ans)

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
ls = len(s)
lt = len(t)
a = 0
for i in range(ls):
    if i >= lt:
        break
    if s[i] != t[i]:
        a += 1
b = 0
for i in range(1, ls-lt+1):
    for j in range(i, ls):
        if j - i >= lt:
            break
        if s[j] != t[j-i]:
            b += 1
    if b < a:
        a = b
print(a)