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:
# 171 B
S = input()
T = input()
ans = []
tmp = 0
for i in range(0, (len(S)-len(T) + 1)):
    if S[i] == T[0]:
        for j in range(1, len(T)):
            if T[j] != S[i + j]:
                tmp += 1
        ans.append(tmp)
        
print(min(ans)) if len(ans) != 0 else print(0)

Submission status: Wrong Answer

Solution code:
# 171 B
S = input()
T = input()
ans = []
tmp = 0
for i in range(0, (len(S)-len(T))):
    if S[i] == T[0]:
        for j in range(1, len(T)):
            if T[j] != S[i + j]:
                tmp += 1
        ans.append(tmp)
        
print(min(ans)) if len(ans) != 0 else print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 171 B
S = input()
T = input()
ans = [0]
tmp = 0
for i in range(0, (len(S)-len(T))):
    if S[i] == T[0]:
        for j in range(1, len(T)):
            if T[j] != S[i + j]:
                tmp += 1
        ans.append(tmp)
        
print(max(ans))

Submission status: Wrong Answer

Solution code:

#from sys import stdin

#input = stdin.readline
#inputRstrip = stdin.readline().rstrip

#x = input().rstrip()
#n = int(input())

#a,b,c = input().split()
#a,b,c = map(int, input().split())

ST = [input() for i in range(2)]
S = ST[0]
T = ST[1]
ans = len(T)

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

Submission status: Wrong Answer

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

s_len = len(s)
t_len = len(t)

out = t_len

for i in range(0, s_len - t_len):
    diff = 0
    for j in range(0, t_len):
        if t[j] != s[i + j]:
            diff += 1
    out = min(out, diff)

print(out)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
stra = []

def find_left_length_word(w):
    return len(w[0])


def find_right_length_word(w):
    return len(w[1])


l = len(t) + 1
for i in range(0, l):
    for j in range(0, i):
        stra.append(t[j:i])

stra.sort(key= len, reverse=1)
stra.pop(0)

for x in stra:

    if x in s:
        temp_question_split = t.replace(x, '_').split('_')
        temp_s_split = s.replace(x, '_').split('_')

        if find_left_length_word(temp_s_split) >= find_left_length_word(temp_question_split) and find_right_length_word(temp_s_split) >= find_right_length_word(temp_question_split):
            print(len(t.replace(x, '')))
            break
        else:
            pass
        # print(temp_s_split)
        # print(find_left_length_word(temp_s_split))
        # print(find_right_length_word(temp_s_split))
        #
        # print(temp_question_split)
        # print(find_left_length_word(temp_question_split))
        # print(find_right_length_word(temp_question_split))

Submission status: Wrong Answer

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

sl = len(S)
tl = len(T)

minc = 1000

for i in range(sl):
    if i+tl-1 >= sl:
        break
    else:
        str1 = S[i:i+tl]
        count=0
        for j in range(tl):
            if str1[j] != T[j]:
                count+=1
        if count < minc:
            minc = count

print(count)

Submission status: Wrong Answer

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

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

result = len(T)-1
x = 0

for i in range(len(S)-len(T)+1):
    for j in range(len(T)):
        if S[i+j] != T[j]:
            x += 1
    if result > x:
        result = x
    x = 0

print(result)

Submission status: Wrong Answer

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

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

result = len(T)-1
x = 0

for i in range(len(S)-len(T)):
    for j in range(len(T)):
        if S[i+j] != T[j]:
            x += 1
    if result > x:
        result = x
    x = 0

print(result)

Submission status: Wrong Answer

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

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

result = len(T)-1
x = 0

for i in range(len(S)-len(T)-1):
    for j in range(len(T)):
        if S[i+j] != T[j]:
            x += 1
    if result > x:
        result = x
    x = 0

print(result)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# B - Substring

S = str(input())
T = str(input())

s = len(S)
t = len(T)
ans = 10**18

for i in range(s-t):
    tmp = 0
    for j in range(t):
        if S[i+j] == T[j]:
            continue
        else:
            tmp += 1
    ans = min(ans, tmp)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = len(T)

l_diff = []

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

Submission status: Wrong Answer

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

for num in range(len(t)):
  if (t[:len(t) - num] in s):
    ans = num
    break
print(num)

Submission status: Wrong Answer

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

ans = len(T)

l_diff = []

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

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
check=[]
for i,ss in enumerate(S[:-len(T)+1]):
    check.append(0)
    for j,tt in enumerate(T):
        if tt==S[i+j]:
            check[i]+=1
# print(check)
check.append(0)
print(len(T)-max(check))

Submission status: Wrong Answer

Solution code:

S=input()
T=input()
check=[]
for i,ss in enumerate(S[:-len(T)+1]):
    check.append(0)
    for j,tt in enumerate(T):
        if tt==S[i+j]:
            check[i]+=1
# print(check)
check.append(0)
print(len(T)-max(check))

Submission status: Wrong Answer

Solution code:

S=input()
T=input()
check=[]
for i,ss in enumerate(S[:-len(T)]):
    check.append(0)
    for j,tt in enumerate(T):
        if tt==S[i+j]:
            check[i]+=1
# print(check)
check.append(0)
print(len(T)-max(check))

Submission status: Wrong Answer

Solution code:

S=input()
T=input()
check=[]
for i,tt in enumerate(T):
    check.append(0)
    for ss in S[i:-(len(T)-i)]:
        if ss==tt:
            check[i]+=1
# print(check)
print(len(T)-max(check))

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ss = len(s)
tt = len(t)
min = tt

for i in range(ss - tt + 1):
  count = 0
  for j in range(tt):
    if s[j] != t[j]:
      count += 1
  if min > count:
    min = count

print(min)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def lcs(S, T):
    dst = ''

    for i in range(len(T)):
        for j in range(i+1, len(T)+1):
            s = T[i:j]
            if S.find(s) > 0 and len(dst) < len(s):
                dst = s

    return dst

if __name__ == '__main__':
    S = input()
    T = input()

    s = lcs(S, T)

    print(len(T) - len(s))

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
print(len(t)-min(sum(x!=y for x,y in zip(s[i:],t))for i in range(-~len(s)-len(t))))

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    S = input()
    T = input()
    len_s = len(S)
    len_t = len(T)
    ans = 100000000
    for i in range(len_s-len_t):
        cunt = 0
        for j in range(len_t):
            if S[i+j] != T[j]:
                cunt += 1
        ans = min(ans, cunt)
    print(ans)

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = list(str(input()))
T = list(str(input()))
i = 0
t = 0
ans = 0
start = 0

while i <= len(T)-1:
    if S[i] == T[i]:
        t = i
        while t <= len(T)-1:
            print(S[t])
            if T[t] == S[t]:
                ans += 1
            t += 1
        break
    i += 1

if ans > 0:
    print(len(T)-ans)
else:
    print(len(T))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
s = input()
t = input()

ans = len(t)

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

    ans = min(ans, dif)

print(ans)

Submission status: Wrong Answer

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

max_ans=0
for i in range(len(S)):
  max_n = 0
  for j in range(len(T)):
    if len(S) > i + len(T):
      if S[i+j]==T[j]:
      	max_n=max_n+1
  
  if max_ans <= max_n:
    max_ans=max_n

print(len(T)-max_ans)

Submission status: Wrong Answer

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

max_ans=0
for i in range(len(S)):
  max_n = 0
  for j in range(len(T)):
    if len(S) > i + j:
      if S[i+j]==T[j]:
      	max_n=max_n+1
  
  if max_ans <= max_n:
    max_ans=max_n

print(len(T)-max_ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a = input()
b = input()

T=1000

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

Submission status: Wrong Answer

Solution code:
a = input()
b = input()

T=1000

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy
 
def main():
    s = input()
    t = input()

    min_num = 10**5
    max_num = 0
    count = 0
    for i in range(len(s) - len(t)):
        for j in range(len(t)):
            if s[i+j] == t[j]:
                count += 1
        if max_num <= count:
            max_num = count
        count = 0

    print(len(t) - max_num)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main(s: str, t: str):
    ans = [0 for _ in range(len(s))]
    for i, si in enumerate(s):
        for j, tj in enumerate(t):
            if i - j > 0 and si == tj:
                ans[i-j] += 1

    print(len(t) - max(ans))


if __name__ == '__main__':
    s = input()
    t = input()
    main(s, t)

Submission status: Wrong Answer

Solution code:
def main(s: str, t: str):
    ans = [0 for _ in range(len(s))]
    for i, si in enumerate(s):
        for j, tj in enumerate(t):
            print(si, tj, i, j)
            if i - j > 0 and si == tj:
                ans[i-j] += 1

    print(len(t) - max(ans))


if __name__ == '__main__':
    s = input()
    t = input()
    main(s, t)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

INF = 10**9

s = input()
t = input()
ans = INF
for i in range(len(s) - len(t) + 1):
  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
from sys import stdin
input = stdin.readline

INF = 10**9

s = input()
t = input()
ans = INF
for i in range(len(s) - len(t) + 1):
  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
from sys import stdin
input = stdin.readline

INF = 10**9

s = input()
t = input()
ans = INF
for i in range(len(s) - len(t) + 1):
  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
from sys import stdin
input = stdin.readline

INF = 10**9

s = input()
t = input()
ans = INF
for i in range(len(s) - len(t) + 1):
  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:
import sys
from sys import stdin
input = stdin.readline

INF = 10**9

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

Submission status: Wrong Answer

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

INF = 10**9

s = input()
t = input()
ans = 10**10
for i in range(len(s) - len(t) + 1):
  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:
import sys
from sys import stdin
input = stdin.readline

INF = 10**9

s = input()
t = input()
ans = INF
for i in range(len(s) - len(t) + 1):
  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:
import sys
from sys import stdin
input = stdin.readline

INF = 10**9

s = input()
t = input()
ans = INF
for i in range(len(s) - len(t)+1):
  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:
import sys
from sys import stdin
input = stdin.readline

INF = 10**9

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

Submission status: Wrong Answer

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

INF = 10**9

s = input()
t = input()
ans = INF
for i in range(len(s) - len(t) + 1):
  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:
import sys
from sys import stdin
input = stdin.readline

INF = 10**9

s = input()
t = input()
ans = INF
for i in range(len(s)):
  if (i+len(t) > len(s)): break
  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()
ans = len(t)

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

    ans = min(ans, dif)
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
a = len(T)
for i in range(len(S)-len(T)):
    c = len(T)
    for j, t in enumerate(T):
        if S[i+j] == t:
            c -= 1
        else:
            if a > c:
                a = c
            c = len(T)
print(a)

Submission status: Wrong Answer

Solution code:
S= input()
T=input()
mi = 1000
for i in range(0,len(S)-len(T)+1):
    c = 0
    for j in range(0,len(T)):
        if S[i+j] != T[j]:
            c += 1
    if mi > c:
        mi = c
print(c)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
ls = len(S)
lt = len(T)
a = 0
for i in range(lt):
    for j in range(i+1,lt+1):
        if T[i:j] in S[i:ls-lt+j]:
            if a < j -i:
                a = j - i
print(lt-a)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
ls = len(S)
lt = len(T)
a = 0
for i in range(lt):
    for j in range(i+1,lt+1):
        if T[i:j] in S[i:ls-lt+j]:
            if a < j -i:
                a = j - i
print(lt-a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = str(input())
b = str(input())

ind = 0
for i in range(len(b)):
  if b[i:len(b)] in a or b[0:len(b)-i] in a:
    ind += 1
print(len(b)-ind)

Submission status: Wrong Answer

Solution code:
a = str(input())
b = str(input())

ind = 0
for i in range(len(b)):
  if b[i:len(b)] in a or b[0:len(b)-i] in a:
    ind += 1
print(len(b)-ind)

Submission status: Wrong Answer

Solution code:
S = input()
s = len(S)
T = input()
t = len(T)

cnt = t
for i in range(s-t):
    dif = 0
    for j in range(t):
        if S[i+j] == T[j]:
            continue
        else:
            dif += 1
    if cnt > dif:
        cnt = dif
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    len_s, len_t = len(s), len(t)
    num_iter = len_s - len_t
    answer = len_t
    for i in range(num_iter):
        s_sub = s[i : i+len_t]
        count = 0
        for s_i, t_i in zip(s_sub, t):
            if s_i == t_i:
                count += 1
        answer = min(answer, len_t-count)
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ans = int(10**10)
# 10**3文字以下なので、O(N**2)でも間に合う
for i in range(len(S) - len(T)):
    part = S[i:i+len(T)]
    cnt = 0
    for j, c in enumerate(part):
        if T[j] != c:
            cnt += 1
    ans = min(ans, cnt)
print(ans)

Submission status: Wrong Answer

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

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

    ans = min(ans, cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
S=list(input())
T=list(input())
SL=len(S)
TL=len(T)
a=TL
for i in range(SL-TL+1):
  b=0 #
  for j in range(TL):
    #print(T[j] ,S[i+j])
    if T[j] != S[i+j] :
      b +=1
  ab=min(b,a)
 
print(ab)

Submission status: Wrong Answer

Solution code:
S=list(input())
T=list(input())
SS=len(S)
TS=len(T)
ans=TS
for i in range(SS-TS):
  cnt=0 #
  for j in range(TS):
    if T[j] != S[i+j] :
      cnt +=1
  ans=min(cnt,ans)

print(ans)

Submission status: Wrong Answer

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

for i in range(len(s)-len(t)+1):
    n=0
    for j in range(len(t)):
        if s[i] != t[j]:
            n+=1
    list.append(n)
print(min(list))

Submission status: Wrong Answer

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

for i in range(len(s)-len(t)+1):
    n=0
    for j in range(len(t)):
        if s[i] == t[j]:
            n+=1
    list.append(n)
print(len(t)-max(list))

Submission status: Wrong Answer

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

for i in range(len(s)-len(t)+1):
    n=0
    for j in range(len(t)-1):
        if s[i] == t[j]:
            n+=1
    list.append(n)
print(len(t)-max(list))

Submission status: Wrong Answer

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

for i in range(len(s)-len(t)+1):
    n=0
    for j in range(len(t)):
        if s[j] == t[j]:
            n+=1
    list.append(n)
print(len(t)-max(list))

Submission status: Wrong Answer

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

t = input().strip()
s = input().strip()
smallchange = len(s)
for i in range(len(t)-len(s)+1):
  x = compare(t[i:len(s)+i], s)
  if smallchange > x:
    smallchange = x
 
print(x)

Submission status: Wrong Answer

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

t = input().strip()
s = input().strip()
smallchange = len(s)
for i in range(len(t)-len(s)+1):
  x = compare(t[i:len(s)+i], s)
  if smallchange > x:
    smallchange = x
 
print(x)

Submission status: Wrong Answer

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

smallchange = len(s)
for i in range(len(t)-len(s)+1):
  x = compare(t[i:len(s)+i], s)
  if smallchange > x:
    smallchange = x

print(x)

Submission status: Wrong Answer

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

ans = 0
for i in range(len(S)):
    tmp = 0
    for j in range(len(T)):
        if S[i] == T[j]:
            pos = i + 1
            j = 1
            tmp += 1
            while pos < len(S)-1 and j < len(T) - 1 and S[pos] == T[j]:
                tmp += 1
                pos += 1
                j += 1
        ans = max(tmp, ans)    

print(len(T)-ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def solve(s, t):
    n = len(s)
    m = len(t)
    best = m
    for i in range(m-n+1):
        num = 0
        for j in range(n):
            if s[j] == t[i+j]:
                num += 1
        best = min(best, num)
    return best
    
s = input()
t = input()
print(solve(s, t))

Submission status: Wrong Answer

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

res = len(t)

for i in range(len(s)-len(t)):
    tmp=len(t)
    for j in range(len(t)):
        if(s[i+j] == t[j]):
            tmp -= 1
    if res > tmp:
        res = tmp

print(res)

Submission status: Wrong Answer

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

res = len(t)

for i in range(len(s)-len(t)):
    tmp=len(t)
    for j in range(len(t)):
        if(s[i+j] == t[j]):
            tmp -= 1
        if res > tmp:
            res = tmp

print(res)

Submission status: Wrong Answer

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

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

for i in range(len(S_list)-len(T_list)+1):
    count = 0
    for j in range(len(T_list)):
        if(S_list[i] != T_list[j]):
            count +=1
            i += 1
    answer = min(count, answer)
print(answer)

Submission status: Wrong Answer

Solution code:
from sys import stdin
inp = lambda : stdin.readline().strip()

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
inp = lambda : stdin.readline().strip()

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

Submission status: Wrong Answer

Solution code:
from sys import exit
import math
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

s = input()
t = input()

ans = len(t)
for i in range(len(s)-len(t)):
    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:
from sys import exit
import math
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

s = input()
t = input()

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

Submission status: Wrong Answer

Solution code:
def subst(S, T)-> int:
  lenT = len(T)
  result = lenT
  for i in range(len(S) - lenT):
    # tempS = S[i-lenT]
    tempResult = 0
    for j in range(lenT):
      if T[j] != S[j + i]:
        tempResult += 1
    if tempResult < result:
      result = tempResult
    
  return result

if __name__ == "__main__":
  S = input()
  T = input()
  print(subst(S, T))

Submission status: Wrong Answer

Solution code:
def subst(S, T)-> int:
  lenT = len(T)
  result = lenT
  for i in range(lenT, len(S)):
    tempS = S[i-lenT:i]
    tempResult = 0
    for j in range(lenT):
      if T[j] != tempS[j]:
        tempResult += 1
    if tempResult < result:
      result = tempResult
    
  return result

if __name__ == "__main__":
  S = input()
  T = input()
  print(subst(S, T))

Submission status: Wrong Answer

Solution code:
def subst(S, T)-> int:
  lenT = len(T)
  result = lenT
  for i in range(lenT, len(S)):
    tempS = S[i-len(T):i]
    tempResult = 0
    for j in range(lenT):
      if T[j] != tempS[j]:
        tempResult += 1
    if tempResult < result:
      result = tempResult
    
  return result

if __name__ == "__main__":
  S = input()
  T = input()
  print(subst(S, T))

Submission status: Wrong Answer

Solution code:
#import 
s=input()
t=input()
#=int(input())
#=map(int,input().split())
#=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]

def ff(x, y):
    l = len(x)
    c = 0
    for i in range(l):
        if x[i] == y[i]:
            c += 1
    return l - c

m = len(t)
for i in range(len(s) - len(t)):
    f = ff(t, s[i:i+len(t)])
    if m > f:
        m = f
print(m)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
n = len(T)
ans = len(T)
for st in range(0, len(S)-len(T)):
    SS = S[st:st+len(T)]
    tmp = len(T)
    for s,t in zip(SS,T):
        if s==t:
            tmp -= 1
        ans = min(ans, tmp)
print(ans)

Submission status: Wrong Answer

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

mc=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
    mc=max(c,mc)
print(len(t)-mc)

Submission status: Wrong Answer

Solution code:
def check_same_sentence(big_str, small_str):
    num_b = len(big_str)
    num_s = len(small_str)
    ans = 0
    for i in range(num_b - num_s):
        tmp = 0
        for j in range(num_s):
            if big_str[i+j] == small_str[j]:
                tmp += 1
        ans = max(ans, tmp)
    # 最大で何文字同じかを返す
    return ans

S = input()
T = input()

ans = check_same_sentence(S, T)
print(len(T)-ans)

Submission status: Wrong Answer

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

ans=10**9
for i in range(len(s)-len(t)):
  ss=s[i:i+len(t)]
  t_ans=0
  for j in range(len(t)):
    if ss[j]!=t[j]:
      t_ans+=1
  ans=min(ans,t_ans)

print(ans)

Submission status: Wrong Answer

Solution code:
# t=int(input())
#
# for some_num in range(0,t):
#     n=int(input())


# s,t=[int(i) for i in input().split(" ")]
s=input()
t=input()
ls=len(s)
lt=len(t)

min_change=lt
print(min_change)

for i in range(0,ls-lt+1):
    if(s[i]==t[0]):
        d = 0
        for j in range(0,lt):
            if(s[i+j]!=t[j]):
                d+=1

        min_change=min(min_change,d)

print(min_change)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

st = []
for _ in range(2):
    st.append(input())
S=st[0]
T=st[1]

ans=len(T)

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

print(ans)

Submission status: Wrong Answer

Solution code:
import sys; input = sys.stdin.readline
inf = int(1e10)
s = input().strip()
t = input().strip()
n, m = len(s), len(t)
minn = inf
for i in range(0, n-m):
	dis = 0
	for j in range(m):
		if s[i+j] != t[j]: dis += 1
	minn = min(minn, dis)
print(minn)

Submission status: Wrong Answer

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

score = []
for i in range(len(S)-len(T)+1):
    U = S[i: i+len(T)]
    cnt = 0
    for j in range(len(T)):
        if U[j] != T[j]:
            cnt = cnt + 1
        score.append(cnt)
print(min(score))

Submission status: Wrong Answer

Solution code:
#B - Substring 
S = str(input())
T = str(input())
i = 0
j = 0

Slen = len(S)
Tlen = len(T)
change_min = Tlen

for i in range(Slen - Tlen):
    diff = 0
    for j in range(Tlen):
        if T[j] != S[i + j]:
            diff += 1
    change_min = min(change_min,diff)

# 出力
print(change_min)

Submission status: Wrong Answer

Solution code:
import numpy as np

s=np.array(list(input()))
t=np.array(list(input()))

ans = len(t)

for i in range(len(s)-len(t)):
    tmp = sum(s[i:i+len(t)] == t)
    if ans > len(t) - tmp:
        ans = len(t) - tmp

print(ans)