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:
#one, two, three, four, five = map(int, input().split())
#li = list(map(int, input().split()))
def Levenshtein(str1,str2):
  count = 0
  for i in range(len(str1)):
    if str1[i] != str2[i]:
      count += 1
  return count

S = input()
T = input()
min_ = 9999999
for i in range(len(S)-len(T)):
  str1 = S[i:i+len(T)]
  str2 = T
  #print(str1,str2)
  leven = Levenshtein(str1,str2)
  if(leven < min_):
    min_ = leven
print(min_)

Submission status: Wrong Answer

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


def a():
    l = len(T)
    for i in range(l, 0, -1):
        for j in range(0, l-i+1):
            if T[j:j+i] in S[j:i+j]:
                return l-i


print(a())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

t_len = len(t)
s_len = len(s)
max_ = 0
temp = 0

for i in range(s_len - t_len):
  for j in range(t_len):
    if s[i + j] == t[j]:
      temp += 1
  if max_ < temp:
    max_ = temp
print(t_len - max_ + 1)

Submission status: Wrong Answer

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

chageCountMin = len(T)

for i,_ in enumerate(S[:-len(T)+1:]):
	changeCount = 0
	for j,_ in enumerate(T):
		if S[i + j] != T[j]:
			changeCount+=1
	chageCountMin = min(chageCountMin,changeCount)
print(chageCountMin)

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

def main():
    s = str(input())
    t = str(input())
    moji = list(longestSubstringFinder(s, t))
    
    print(len(list(t))-len(moji))

main()

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 s:
    for k in t:
        if j == k:
            s0 = s[:s.index(j)]
            s1 = s[s.index(j):]
            t0 = t[:t.index(k)]
            t1 = t[t.index(k):]
            if len(s0) > len(s1) and len(t0) > len(t1): print(len(t) - 1)

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]:
            flag = 1
            print(i-1)
            break

if flag == 0:
    print(l)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
def cout_dif(a, b):
    sum = 0
    for i in range(len(a)):
        if a[i] != b[i]:
            sum += 1
    return sum
    
def main():
    s = input()
    t = input()
    min = 10**5
    for i in range(len(s)-len(t)):
        sum = cout_dif(t, s[i:i+len(t)])
        if sum < min:
            min = sum
    print(min)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

    ans = 0
    for v in range(len(t)):
        v1 = t[0:len(t) - v]
        v2 = t[0 + v:]
        v3 = t[0 + v:len(t) - v]

        if v1 in s:
            id = s.index(v1)
            if len(t)-v < len(s) - id:
                ans += v
                break
        if v2 in s:
            id = s.index(v2)
            if len(t)-v < id:
                ans += v
                break
        if v3 in s:
            id = s.index(v3)
            if len(t)-v < len(s) - id and v < id:
                ans += v
                break
    print(ans)


if __name__ == '__main__':
    Qb()

Submission status: Wrong Answer

Solution code:
def resolve():
    S = input()
    T = input()
    mincnt = float("inf")
    for ptr in range(len(S)-len(T)):
        cnt = 0
        for i in range(len(T)):
            sptr = ptr + i
            if S[sptr] != T[i]:
                cnt += 1
        mincnt = min(cnt, mincnt)
    print(mincnt)



    
if '__main__' == __name__:
    resolve()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

T_length = len(T)
max_count = 0

for i in range(len(S)-T_length+1):
  count = 0
  for j in range(T_length):
    if S[i:i + T_length][j] == T[j]:
      count += 1
  else:
    if max_count > count:
      max_count = count

print(T_length - max_count)

Submission status: Wrong Answer

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

ok = False
mmax= 0
for i in range(len(s)-len(t)):
    cnt=0
    for y in range(len(t)):
        if s[i+y]==t[y]:
            cnt+=1
    mmax = max(mmax,cnt)
print(n-mmax)

Submission status: Wrong Answer

Solution code:
# def Substring(S, T):
#     n = len(S)
#     m = len(T)
#     dic = {}
#
#     def traverse(i, j):
#         if i != n and j == m:
#             return 0
#         elif (i, j) in dic:
#             return dic[(i, j)]
#         else:
#             if S[i] == T[j]:
#                 ans = traverse(i + 1, j + 1)
#             else:
#                 ans = 1 + min(traverse(i + 1, j + 1), traverse(i+1,j))
#         return ans
#     return traverse(0,0)
# print(Substring("cabacc",
# "abc"))

def char_match(s,t,m):
    match = 0
    for i in range(m):
        if s[i] == t[i]:
            match += 1
    return match
def substring(S,T):
    m = len(T)
    char_mismatch = float("inf")
    for i in range(0,len(S)-m):
        char_mismatch = min(char_mismatch, m - char_match(S[i:i+m],T, m))
    return char_mismatch

def start():
    S = input()
    T = input()
    print(substring(S,T))
start()

Submission status: Wrong Answer

Solution code:
s=input()
n1=len(s)
t=input()
n=len(t)
mini=int(1e9)
start=0
end=n
md=0
while end!=n1:
    md=0
    j=0
    for i in range(start,end,1):
        if s[i]!=t[j]:
            md+=1
        j+=1
    mini=min(mini,md)
    start+=1
    end+=1
print(mini)

Submission status: Wrong Answer

Solution code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


s = S()
t = S()
if s == t:
    print(0)
    exit()
ans = len(t)
for i in range(len(s)-len(t)):
    # print(f'{i=}')
    now = 0
    for j in range(len(t)):
        # print(f'{(s[i+j], t[j])=}')
        if s[i+j] != t[j]:
            now += 1
    # print(f'{now=}')
    ans = min(ans, now)

print(ans)

Submission status: Wrong Answer

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

max_len = 0
for left in range(len(T)):
    for right in range(0, len(T) - left):
        if right == 0:
            tmpT = T[left:]
            tmpS = S[left:]
        else:
            tmpT = T[left:-right]
            tmpS = S[left:-right]
        # print(tmpT, tmpS)
        if tmpT in tmpS:
            max_len = max(len(tmpT), max_len)

print(len(T) - max_len)

Submission status: Wrong Answer

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

dist = len(S)

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

print(dist)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
s = input()
t = input()
n = len(t)
change = n
for size in range(n):
  for t_range in range(n-size):
    bubun = t[t_range:t_range+size]
    for s_range in range(t_range,len(s)-size):
      if change == size:
        break
      elif bubun == s[s_range:s_range+size]:
        change = size

print(n-change)

Submission status: Wrong Answer

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

best_num_char=0
for i in range(len(S)-len(T)):
    # print(T[i:])
    num_char=0
    for j in range(len(T)):
        num_char+=1 if S[i+j]==T[j] else 0
        # print(num_char,S[i + j])
    if best_num_char<num_char:
        best_num_char=num_char

# print(len(T))
print(len(T)-best_num_char)

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
cnt = 0
s_len = len(s)
t_len = len(t)
sa = s_len - t_len
Max = -1
for i in range(sa):
    ss = s[i:i+len(t)]
    for j in range(len(t)):
        if ss[j] == t[j]:
            cnt += 1
    Max = max(Max,cnt)
    cnt = 0
print(len(t) - Max)

Submission status: Wrong Answer

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

cnt = 0
ans = 1001

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

print(ans)

Submission status: Wrong Answer

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

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

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

print(m - ma)

Submission status: Wrong Answer

Solution code:
string = input()
sub_string = input()

change = 0

for i in range(0, len(sub_string)):
  if sub_string[i] in string:
    if sub_string[i] != string[i]:
      change += 1
  else: 
    change += 1
  
print(change)

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

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

Submission status: Wrong Answer

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

chageCountMin = len(T)

for i,_ in enumerate(S[:-len(T):]):
	changeCount = 0
	for j,_ in enumerate(T):
		if S[i + j] != T[j]:
			changeCount+=1
	chageCountMin = min(chageCountMin,changeCount)
print(chageCountMin)

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout
from collections import Counter,deque
import math
cin = stdin.readline
cout = stdout.write
def inpn():
    return(int(cin()))
def inpl():
    return(list(map(int,cin().split())))
def inps():
    return cin()[:-1]
def inpv():
    return (map(int, cin().split()))
def outs(s):
    cout(s)
def outn(n):
    cout(str(n))
def outl(l):
    for i in l:
        cout(str(i)+" ")
def outb(s):
    cout(str(s))


# n = inpn()
# l=inpl()
# m=1000000007
# add=0
# for i in range(n-1):
#     for j in range(i+1,n):
#         add+=(l[i]%m*l[j]%m)%m
#
# outn(add%m)
# cout("\n")

s=inps()
t=inps()
ans=1000
if t in s:
    outn(0)
    cout("\n")
else:
    if len(s)!=len(t):
        for i in range(len(s)-len(t)):
            ans=0
            for j in range(len(t)):
                if s[i+j]!=t[j]:
                    ans+=1
            ans=min(ans, ans)
        outn(ans)
        cout("\n")
    else:
        ans=0
        for i in range(len(s)):
            if s[i]!=t[i]:
                ans+=1
        outn(ans)
        cout("\n")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
a=len(s)
b=len(t)
m=b
for i in range(a-b):
    c=0
    for j in range(b):
        if s[i+j]!=t[j]:
            c+=1;
    if c<m:
        m=c
print(m)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
if t in s:
    print(0)
else:
    ans=1000
    for i in range(len(s) - len(t)):
        c = 0
        f = 0
        for j in range(i, i + len(t)):
            if s[j] != t[f]:
                c += 1
            f += 1
        ans = min(ans, c)
    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(T)):
  tmp = T[i:]
  if tmp in S[i:]:
    if ans > i:
      ans = i
    break
    
for i in range(1,len(T)):
  tmp = T[:len(T)-i]
  if tmp in S[:len(T)-i]:
    if ans > i:
      ans = i
    break
    
for i in range(1,len(T)//2):
  tmp = T[i:len(T)-i]
  if tmp in S[i:len(T)-i]:
    print(tmp)
    if ans > 2*i:
      ans = 2*i
    break

print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
    all_string = input()
    target_string = input()
    all_length = len(all_string)
    target_length = len(target_string)
    max_count = 0
    for i in range(all_length - target_length + 1):
        count = 0
        part_string = all_string[i:target_length]
        for s1, s2 in zip(part_string, target_string):
            if s1 == s2:
                count +=1
        if count>max_count:
            max_count = count
    print(target_length - max_count)
resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


def a():
    l = len(T)
    for i in range(l, 0, -1):
        for j in range(0, l-i+1):
            if T[j:j+i] in S[j:l-i+j]:
                return l-i


print(a())

Submission status: Wrong Answer

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

maxtmp = 0
if len(S) == 1:
    if T in S:
        print(0)
    else:
        print(1)
else:
    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 maxtmp < tmp:
            maxtmp = tmp
    print(len(T) - maxtmp)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
a = b = l = len(t)

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

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

print(min(a, b))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

max_same = 0
ans = 0

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

print(len(t)-ans)

Submission status: Wrong Answer

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

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

print(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 h in range(len(T)):
        if(S[i+h] != T[h]):
            count+=1
    if(Min_count >count):
        Min_count = count

print(Min_count)

Submission status: Wrong Answer

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

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

min_count = float('inf')
for i in range(len_S - len_T):
    # print(S[i:i+len(T)])
    match = 0
    for j in range(len_T):

        if T[j] == S[i + j]:
            match += 1
    min_count = min(len_T-match, min_count)
print(min_count)

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) - len(T[i:j]) < ans:
                ans = len(T) - len(T[i:j])

print(ans)

Submission status: Wrong Answer

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

flag = False
for i in range(lt):
    for j in range(i+1):
        a = i-j
        ss = s[j:ls-a]
        tt = t[j:lt-a]
        if tt in ss:
            flag = True
            break
    if flag:
        break
if flag:
    print(i)
else:
    print(lt)

Submission status: Wrong Answer

Solution code:
s = input()

t = input()

ans_sub = ''

for i in range(len(t) - 2 + 1):
    sub = t[i:]

    if sub in s:
        ans_sub = sub
        break

    sub = t[:len(t) - 1]

    if sub in s:
        ans_sub = sub
        break

if len(ans_sub) == 0:
    for j in t:
        if j in s:
            ans_sub = j

ans = len(t) - len(ans_sub)

print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
    S = input()
    T = input()
    maxcnt = 0
    for ptr in range(len(S)-len(T)):
        cnt = 0
        for i in range(len(T)):
            sptr = ptr + i
            if S[sptr] == T[i]:
                cnt += 1
        maxcnt = max(cnt, maxcnt)
    print(len(T)-maxcnt)



    
if '__main__' == __name__:
    resolve()

Submission status: Wrong Answer

Solution code:
S = input().rstrip()
T = input().rstrip()
count = 0
lens = len(S)
lent = len(T)
for i in range(lens-lent+1):
    tempcount=0
    for j in range(lent):
        if S[i+j]==T[j]:
            tempcount += 1
    print(tempcount)
    count = max(count,tempcount)

print(lent-count)

Submission status: Wrong Answer

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
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():
    s = S()
    t = S()
    ans = len(t)
    slenth = len(s)
    lenth = len(t)

    for i in range(1,lenth+1):
        for j in range(lenth-i+1):
            start = j
            goal = slenth-(lenth-j-1 )+i-1
            rng = s[start:goal]
            ex = t[j:j+i]
            if ex in rng:
                ans = lenth-i
    
    print(ans)
main()

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
SL=len(S)
TL=len(T)
ans2=0
for i,key1 in enumerate(T):
    ans=0
    for j,key2 in enumerate(S):
        if key1==key2:
            ans+=1
        while TL<i and SL<j and j-i<=SL-TL:
            i+=1
            j+=1
            if T[i]==S[j]:
                ans+=1
                
    ans2=max(ans2,ans)
print(TL-ans2+1)

Submission status: Wrong Answer

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

min_count = len(T)
for t_s in range(0, len(T)):
    j = t_s
    max_matched = 0
    matched = 0
    for s_i in range(t_s, len(S)):
        # print(f's_i={s_i}, j={j}')
        if S[s_i] == T[j]:
            matched += 1
            j += 1
            if j == len(T):
                if max_matched < matched:
                    max_matched = matched
                break
        else:
            # j stays on the current
            if max_matched < matched:
                max_matched = matched
            matched = 0  # reset matched count
    # print(f'max_matched={max_matched}')
    count = len(T) - max_matched
    if count < min_count:
        min_count = count
print(min_count)

Submission status: Wrong Answer

Solution code:
import numpy as np
s = np.array(list(input()))
t = np.array(list(input()))
s_sub = np.array(list((s[i:i+len(t)] for i in range(len(s)-len(t)+1))))
print(s_sub)
ans = [0]*len(s_sub)
for i in range(len(s_sub)):
    ans[i] = np.count_nonzero(s_sub[i] == t)
print(len(t)-max(ans))

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
a=int(len(S))
b=int(len(T))
count=0
c=0
for i in range(a-b):
    for j in range(b):
        if S[i+j]==T[j]:
            count+=1
    if c<count:
        c=count
    count=0
print(b-c)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
count = 0
#SのなかでTを動かしていき最大マッチ数を考える
for i in range(len(S)-len(T)+1):
    check = S[i:len(T)+i-1]
    point = 0
    for w1, w2 in zip(T, check):
        if w1 == w2:
            point += 1
    if point > count:
        count = point
print(len(T)-count)

Submission status: Wrong Answer

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

cnt = 0
for i in range(len(S) - len(T) + 1):
    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
    cnt = max(cnt, tmp)

print(len(T) - cnt)

Submission status: Wrong Answer

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

T_length = len(T)
max_count = 0

for i in range(len(S)-T_length+1):
  count = 0
  for j in range(T_length):
    if S[i:i + T_length][j] == T[j]:
      count += 1
  else:
    if max_count > count:
      max_count = count

print(T_length - count)

Submission status: Wrong Answer

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

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import math
from operator import mul
from functools import reduce
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)

# lis_of_lis = [[] for _ in range(N)]


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


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

min_ = 0
max_ = len(T)
# len(S) - len(T) + 1
for x in range(max_):
    # x文字置き換えて良い
    for i in range(len(S) - len(T) + 1):
        count = 0
        for (a, b) in zip(T, S[i:i + len(T)]):
            if (a == b):
                count += 1
        if (count+x >= len(T)):
            print(x)
            exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

answer = 10**3

for s in range(len(S)):
  if s + len(T) < len(S):
    count = 0
    for t in range(len(T)):
      if S[s+t] != T[t]:
        count += 1
    answer = min(answer, count)
print(answer)

Submission status: Wrong Answer

Solution code:
def match_num(s, part_s):
    match = 0
    max_match = 0
    for (s_char, part_s_char) in zip(s, part_s):
        if s_char == part_s_char:
            match += 1
        else:
            if match > max_match:
                max_match = match
            match = 0

    return max_match


s = input()
t = input()

max_match = 0

for i in range(len(s)):
    if i+len(t) > len(s):
        break
    part_s = s[i:i+len(t)]
    match = match_num(t, part_s)
    if match > max_match:
        max_match = match

print(len(t)-max_match)

Submission status: Wrong Answer

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

ans = len(T)
for i in range(len(T)):
    subset_T = T[i:]
    for j in range(i, len(S) - len(subset_T)):
        if subset_T[0] == S[j]:
            subset_S = S[j:j + len(subset_T)]
            cnt = i
            for s, t in zip(subset_S, subset_T):
                if s != t:
                    # print(f'{s=}, {t=}')
                    cnt += 1
            ans = min(ans, cnt)
            # print(f'{i=}, {subset_T=}, {subset_S=}, {ans=}, {cnt=}')
print(ans)

Submission status: Wrong Answer

Solution code:
string = input()
sub_string = input()

change = 0

for i in range(0, len(sub_string)):
  if sub_string[i] in string:
    if sub_string[i] != string[i]:
      change += 1
  else: 
    change += 1
    
if change == len(sub_string):
  change = 1
  
print(change)

Submission status: Wrong Answer

Solution code:
def partial_match_table(word):
    table = [0] * (len(word) + 1)
    table[0] = -1
    i, j = 0, 1

    while j < len(word):
        matched = word[i] == word[j]

        if not matched and i > 0:
            i = table[i]
        else:
            if matched:
                i += 1
            j += 1
            table[j] = i

    return table


def kmp_search(text, word):
    table = partial_match_table(word)
    i, p = 0, 0

    while i < len(text) and p < len(word):
        if text[i] == word[p]:
            i += 1
            p += 1
        elif p == 0:
            i += 1
        else:
            p = table[p]

    return (-1, i - p)[p == len(word)]


def main():
    s = input()
    t = input()
    for text_num in range(len(t), 0, -1):
        ret = kmp_search(s, t[:text_num])
        if ret != -1:
            print(len(t) - text_num)
            return
    print(text_num)
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

for length in reversed(range(1,len(T))):
    for start in range(len(T) - length):
        if T[start:start + length] in S[start:]:
            print(len(T) - length)
            #print(T[start:start + length])
            #print(S[start:])
            break
    else:
        continue
    break

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 ):
        same = 0
        
        for j in range( len_t ):
            if s[ i + 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()

def count():
    l = len(t)
    l2 = len(s)
    for count in range(l+1):
        for i in range(count+1):
            x = t[i:l-count+i]
            # print(x,s[i:l2-count+i])
            if x in s[i:l2-count+i]:
                return count
print(count())

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:-(len_S - now_len_part)].count(part_str):
        max_part = now_len_part

print(len(T) - now_len_part)