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:
# coding: utf-8
# Your code here!
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re
import math


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


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

    ans = float("inf")

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

    tmp = []
    for i in range(len(T)):
        for j in range(i, len(T)):
            tmp.append(T[i:j+1])
    tmp.sort(key=len, reverse=True)

    for t in tmp:
        if t in S and S.index(t) == T.index(t):
            print(len(T) - len(t))
            exit()
    print(len(T))      

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# d, t, s = map(int, input().split())
s = input()
t = input()


def diff(a, b, minCount):
    count = 0
    for i in range(len(a)):
        if a[i] != b[i]:
            count += 1
    return min(minCount, count)


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

minc = 1001
for i in range(0, len(s) - len(t)):
    minc = diff(s[i: i + len(t)], t, minc)
print(minc)

Submission status: Wrong Answer

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

def find_common(s1, s2):
    count = 0
    for c,y in zip(s1, s2):
        if c == y:
            count += 1
    return count

start = 0 
end =  len(t)
ans  = 0
while end < len(s):
    ans  = max(ans, find_common(t, s[start:end]))
    start+=1
    end+=1
print(len(t)- ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
 
# t, s = map(str,input().split())

s = input()
t = input()

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

    min_change = min(min_change, change)

print(min_change)

Submission status: Wrong Answer

Solution code:
from sys import stdin

def check_str(s,t):
    com = 0
    for a,b in zip(s,t):
        if a == b:
            com += 1
    return com

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

    common = 0
    for i in range(len(s)):
        common = max(common, check_str(s[i:],t))

    print(len(t)-common)

    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
S=str(input())
S=list(map(str,S))
T=str(input())
T=list(map(str,T))
Ca=len(T)
for i in range(len(S)-len(T)+1):
  Cb=len(T)
  for j in range(len(T)):
    if S[i+j]==T[j]:
      Cb-=1
  if Ca>Cb:
    Ca=Cb
print(Cb)

Submission status: Wrong Answer

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

for i in range(len(T), 0, -1):
    for j in range(len(T)-i+1):
        subst = T[j:i+j]
#        print(subst)
        if S.find(subst, j)>=0:
            print (len(T)-i)
            exit(0)

Submission status: Wrong Answer

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

min_ = 99999
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 count < min_:
        min_ = count
print(count)

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
mini = len(b)
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 = input()
T = input()

ans1 = len(T)
ans2 = len(T)
for i in range(len(T)):
    if T[0:i+1] in S:
        ans1 = len(T) - i - 1
    if T[::-1][0:i+1][::-1] in S:
        ans2 = len(T) - i - 1 
print(min(ans1, ans2))

Submission status: Wrong Answer

Solution code:
from collections import deque
import sys, copy, itertools,heapq
input = sys.stdin.readline

S = input().rstrip()
T = input()
s=len(S)
t= len(T)
ANS=[0]*(len(S))

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

#print(ANS)
print(t-max(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

print(ans)

Submission status: Wrong Answer

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

count = 0

for i,j in enumerate(T):
    if T[:i+1] in S:
        count += 1
    else:
        pass

print(len(T)-count)

Submission status: Wrong Answer

Solution code:
def resolve():
    S = input()
    T = input()
    for matches in range(len(T), 0, -1):
        for ptr in range(len(T)):
            if ptr+matches > len(T):
                break
            subt = T[ptr:ptr+matches]
            if subt in S[ptr:]:
                print(len(T)-matches)
                return
    print(len(T))



    
if '__main__' == __name__:
    resolve()

Submission status: Wrong Answer

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

cnt =0
ans = len(t)
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(cnt, ans)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

def longestSubstringFinder(string1, string2):
    answer = ""
    len1, len2 = len(string1), len(string2)
    for i in range(len1):
        match = ""
        for j in range(len2):
            if (i + j < len1 and string1[i + j] == string2[j]):
                match += string2[j]
            else:
                if (len(match) > len(answer)): answer = match
                match = ""
    return answer


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

Submission status: Wrong Answer

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

match = 0
c=0

for i in range(0,len(s)):
    if s[i]==t[c]:
        c+=1
        match+=1
        if c==len(t):
            arr.append(match)    
            break    
    else:
        arr.append(match)
        c=0
        match=0

# print(len(t),max(arr))
print(len(t)-max(arr))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
num=len(s)-len(t)
res=[]
for n1 in range(0,num+1):
    count=0
    for n2 in range(0,len(t)):
        if(t[n2]!=s[n1+n2]):
            count+=1
    print(count)
    res.append(count)
print(min(res))

Submission status: Wrong Answer

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

sl = len(s)
tl = len(t)
count = 0
for i in range(0,sl-tl+1):
    sb = s[i:i+tl]
    for j in range(tl):
        co = 0
        if sb[j] == t[j]:
            co += 1
    if co > count:
        count = co

print(tl - count)

Submission status: Wrong Answer

Solution code:
S = input()
T = input() #s>t
ans = 1000
d = len(S) - len(T)
for i in range(d):
    s = S[i:i + len(T)]
    t = T
    a = 0
    #print(s,t)
    for j in range(len(T)):
        if not(s[j] == t[j]):
            a+=1
    if  a <ans:
        ans = a
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

s_len = len(S)
t_len = len(T)

max_same = 0
for i in range(s_len-t_len):
    tmp_s = S[i:i+t_len]
    count_same = 0
    for j in range(t_len):
        if T[j] == tmp_s[j]:
            count_same += 1
    if count_same > max_same:
        max_same = count_same
print(t_len-max_same)

Submission status: Wrong Answer

Solution code:
import numpy as np
x = str(input())
y = str(input())

a=np.array(list(x))
b=np.array(list(y))
ans=0

for i in range(len(a)-len(b)):    
    tmp=(a[i:len(b)+i]==b).sum()
    if ans<tmp:
        ans=tmp
        
print(len(b)-ans)

Submission status: Wrong Answer

Solution code:
ss = str(input())
tt = str(input())
#print(ss,tt)
maxlength = 0
for i in range(len(tt)-1):
    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(tt[i:j])

print(len(tt)-maxlength)

Submission status: Wrong Answer

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

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

print(len(t) - max_len)

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]
    if word == t: break
    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:
def main():
    s = input()
    t = input()

    # sがtの長さにおいて一致している最大の文字数を特定
    max_counter = 0

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

    answer = len(t) - max_counter
    print(answer)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

count = 0
reg = 0

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

reg = len(t) - reg
print(reg)

Submission status: Wrong Answer

Solution code:
import sys
S=sys.stdin.readline().strip()
len_s=len(S)
T=sys.stdin.readline().strip()
S=S[1:]+"1"*1000

ans=float("inf")
for i in range(len_s):
    temp_ans=0
    for s,t in zip(S[i:],T):
        if s!=t:
            temp_ans+=1
    ans=min(ans,temp_ans)
print ans

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
maxCnt = 0
len_s = len(s)
len_t = len(t)
for i in range(len_s - len_t):
    cnt = 0 
    s_str = s[i:i+len_t]
    for j in range(len(t)):
        if t[j] == s_str[j]:
            cnt += 1
        else:
            pass
    maxCnt = max(maxCnt, cnt)
ans = len_t - maxCnt
print(ans)

Submission status: Wrong Answer

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

min_ = 99999
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 count < min_:
        min_ = count
count

Submission status: Wrong Answer

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

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

L = 0
judge = False

for i in range(len(T), -1, -1):
    for j in range(len(T)-i):
        if T[j:j+i] in S[j:]:
            L = i
            # print(T[j:j+i])
            judge = True
            break
    if judge:
        break

print(len(T)-L)

Submission status: Wrong Answer

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

match = 0
k = 0
result = 0
for i in range(len(S)-len(T)) :
    k = i # start
    match = 0
    for j in range(len(T)) :
        if T[j] == S[k] :
            match = match + 1
        k += 1
    result = max(result,match)
print(len(T) - result)

Submission status: Wrong Answer

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

for i in range(len(T), 0, -1):
    for j in range(len(T)-i+1):
        subst = T[j:i+j]
#        print(subst)
        if S.find(subst, j)>=0:
            print (len(T)-i)

Submission status: Wrong Answer

Solution code:
def LCSubStr(X, Y, m, n): 
	LCSuff = [[0 for k in range(n+1)] for l in range(m+1)] 
	result = 0
	for i in range(m + 1): 
		for j in range(n + 1): 
			if (i == 0 or j == 0): 
				LCSuff[i][j] = 0
			elif (X[i-1] == Y[j-1]): 
				LCSuff[i][j] = LCSuff[i-1][j-1] + 1
				result = max(result, LCSuff[i][j]) 
			else: 
				LCSuff[i][j] = 0
	return result 
X = input()
Y = input()
m = len(X) 
n = len(Y)
print(n-LCSubStr(X, Y, m, n))

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

S = input()
T = input()

ans = float("Inf")

len_s = len(S)
len_t = len(T)
if len_t == 0:
    ans = 0

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

print(ans)

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

if flag == 0:
    print(l)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
len_T = len(T)
d = len(S)-len_T
result = 1001
for i in range(d+1):
    if i == d:
        x = S[i:]
    else:
        x = S[i:-d+i]
    sum = 0
    for i in range(len_T):
        if T[i] == x[i]:
            sum += 1
    sum = len_T - sum
    if result > sum:
        result = sum
    if result == 0:
        print(result)
print(result)

Submission status: Wrong Answer

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

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


main()

Submission status: Wrong Answer

Solution code:
S = str(input())
T = str(input())
ans = 10**9
for i in range(0,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 = input()
T = input()
m = 0
for i in range(len(T)):
  for j in range(i+1,len(T)+1):
       if T[i:j] in S:
            ind = S.index(T[i:j])
            if ind >= i:
              m = max(m,len(T[i:j]))
print(len(T)-m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
a=len(s)
b=len(t)
ans=1001
kari=0
k=0
for i in range(0,a-b):
    kari=0
    k=0
    for j in t:
        if j!=s[i+k]:
            kari+=1
        k+=1
    if ans>kari:
        ans=kari
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
if t in s:
  print(0)
else:
  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 = list(str(input()))
T = list(str(input()))

l = len(S) - len(T)
f = len(T)

for i in range(l):
    temp = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            temp += 1
    if f > temp:
        f = temp

print(f)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
d = len(S) - len(T)
print(len(T) - max(sum(t == s for t, s in zip(T, S[i : i + d + 1])) for i in range(d + 1)))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s = list(map(str,input()))
t = list(map(str,input()))

same = 0

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

print(max(0,len(t) - same))

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
m = len(t)
for i in range(len(s)-len(t)+1):
    c = 0
    target = list(s[i:i+len(t)])
    for j in range(len(target)):
        if not target[j] == t[j]:
            c += 1
    if c < m :
        m = c
print(c)

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:
def cin():  return list(map(int,input().split()))

S = input()
T = input()

ans = 10 ** 9 + 7
l1 = len(S)
l2 = len(T)
for i in range(l1 - l2):
    cnt = 0
    for j in range(l2):
        if S[i + j] != T[j]:  cnt += 1
    ans = min(ans, cnt)
print(ans)

Submission status: Wrong Answer

Solution code:
S = str(input())
T = str(input())
X = []

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

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
    X.append(cnt)

print(len(T)-cnt)

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

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

print(c_min)

Submission status: Wrong Answer

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

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

ans = len_T
for i in range(len_S - len_T):
    match = 0
    for s, t in zip(S[i:i + len_T], T):
        if s == t:
            match += 1
    change = len_T - match
    ans = min(ans, change)

print(ans)

Submission status: Wrong Answer

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

l = 0
m = 0
for i in range(len(S)):
    for j in range(len(T)):
        if S[i] == T[j]:
            l += 1
            break
        else:
            m = max(l,m)
            l = 0
ans = len(T) - m
print(ans)

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
n=len(T)
l=len(S)-n
p=0
for i in range(l):
    j=0
    m=S[i:i+n]
    
    for k in range(n):
        if(m[k]==T[k]):
            j+=1

    if(p<j):
        p=j
print(n-p)

Submission status: Wrong Answer

Solution code:
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))


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

INF=10**9
ans=INF
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(tmp)

Submission status: Wrong Answer

Solution code:
s=input()
l=input()
len_s=len(s)
len_l=len(l)
a=len_s-len_l
ans=1001
for i in range(len_s-len_l):
    cnt=0
    for j in range(len_l):
        if l[j]!=s[i+j]:
            cnt+=1
    ans=min(ans,cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
s = input() # all
t = input() # substring

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

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

print(min_length)

Submission status: Wrong Answer

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


print(len(t) - len(longestSubstringFinder(s, t)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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+1]:
            ans = min(ans,len(t)-len(t[i:l]))

print(ans)

Submission status: Wrong Answer

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

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

ans = tl
for i in range(sl):
    if i+tl >= sl:
        break
    count = 0
    for j in range(tl):
        if S[i+j] != T[j]:
            count += 1
    ans = min(ans, count)
print(ans)

Submission status: Wrong Answer

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

len_s = len(S)
len_t = len(T)

max_count = 0
for x in range(len_s - len_t):
    

    count = 0 #初期化
    for y in range(len_t):
#        print(S[y+x], T[y])
        if S[y+x] == T[y]:
            count += 1
        else:
            pass
#        print(count)

    if max_count < count:
        max_count = count
#    print(x, max_count)
    
print(len_t - max_count)

Submission status: Wrong Answer

Solution code:
from sys import stdin

def check_str(s,t):
    com = 0
    print(s)
    for a,b in zip(s,t):
        if a == b:
            com += 1
    return com

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

    common = 0
    for i in range(len(s)):
        common = max(common, check_str(s[i:],t))

    print(len(t)-common)

    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
S,T=input(),input()
res=n=len(T)
m=len(S)
for i in range(m-n):
    c = 0
    for k in range(n):
        if S[i+k]!=T[k]:
            c+=1
    res=min(res,c)
print(res)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
mx = float('-inf')
for i in range(0, len(s)-len(t)+1):
    # print(i)
    k = 0
    cnt = 0
    for j in t:
        # print(s[i], j)
        if s[i+k]==j:
            cnt+=1
            mx = max(cnt, mx)
        k+=1
print(len(t)-mx)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
def func():
    for i in reversed(range(1,len(T)+1)):
        p=T[0:i]
#        print(i,p)
        if (-1!=S.find(p)):
            return(len(T)-i)
        p=T[len(T)-i:len(T)]
#        print(i,p)
        if (-1!=S.find(p)):
            return(len(T)-i)

print(func())

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
n=len(t)
r1=0
for i in range(n):
    #print(str(i),t[i:],s)
    if t[i:] in s:
        r1=i
        #print(r1)
        break
    r1=n
r2=0
for j in range(n):
    #print(str(j),t[:n-j],s)
    if t[:n-j] in s:
        r2=j
        #print(r2)
        break
    r2=n
print(min(r1,r2))

Submission status: Wrong Answer

Solution code:
import sys

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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


def ST(): return input().replace('\n', '')
import sys
import itertools
import copy


def main():
    # D, T, S = MI()
    # L = LLIN(N)
    S = input()
    T = input()

    ushiro = 0
    for i in range(len(T)):
        # print(T[0:len(T)-i])
        a = T[0:len(T)-i]
        ushiro = i
        if a in S:
            break
    mae = 0
    for i in range(len(T)):
        # print(T[i:len(T)])
        b = T[i:len(T)]
        mae = i
        if b in S:
            break
    # print(ushiro)
    # print(mae)
    print(min(ushiro,mae) - 1)
    #     if T[-i]
    # if D / T <= S:
    #     print('Yes')
    # else:
    #     print('No') 
    # cnt = 0
    # for l in L:
    #     num = l[0] ** 2 + l[1] ** 2 
    #     if num <= D ** 2:
    #         cnt+=1
    # print(cnt)
    # print(row)
    # total = sum(row)
    # target = total - K
    # if K == total:
    #     print(1)
    #     sys.exit()
    # col = []
    # for w in range(W):
    #     cnt = 0
    #     for h in range(H):    
    #         print(A[h][w])
    #         if A[h][w] == '#':
    #             cnt += 1
    #     col.append(cnt)
    # print(col)
    # ans = 0
    # for w in range(W):
    #     for h in range(H):
    #         if A[h][w] == '#':
    #             if col[w] + row[h] - 1 == target:
    #                 print(str(h) + str(w))
    #                 ans +=1
    #         else:
    #             if col[w] + row[h] == target:
    #                 print(str(h) + str(w))
    #                 ans +=1
    # print(ans)
    #     for  in x:


    # print('AC x ' + str(cnt['AC']))
    # print('WA x ' + str(cnt['WA']))
    # print('TLE x ' + str(cnt['TLE']))
    # print('RE x ' + str(cnt['RE']))
    

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

c = len(S) - len(T)

m = 10000
for i in range(c):
    count = 0
    for s, t in zip(S[i:], T):
        if s != t:
            count += 1
    m = min(m, count)
print(m)

Submission status: Wrong Answer

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

match_list = [0]*len(S)

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

print(len(T) - max(match_list))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

tmp = []

for i in range(len(T)):
    if T[:i+1] in S:
        tmp.append(1)
    else:
        tmp.append(0)

tmp.reverse()

flag = False
ans = 0

for i in range(len(tmp)):
    if tmp[i] == 1:
        ans = i
        flag = True
        break
        
if flag == False:
    print(len(tmp)-1)
else:
    print(i)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate

sys.setrecursionlimit(10**6)
INF = 10**12
m = 10**9 + 7

def main():
    S = input()
    N = len(S)
    T = input()
    M = len(T)
    ans = INF
    for i in range(N-M):
        cnt = 0
        for k in range(M):
            if S[i+k] != T[k]:
                cnt += 1
        ans = min(ans, cnt)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

L = 0
judge = True

for i in range(len(T), -1, -1):
    for j in range(len(T)-i):
        if T[j:j+i] in S[j::]:
            L = i
            # print(T[j:j+i])
            judge = False
            break
    if not judge:
        break

print(len(T)-L)

Submission status: Wrong Answer

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

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

print(result)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ns = len(s)
nt = len(t)
ret = ns + 1
for i in range(ns - nt):
  tmp = 0
  for j in range(nt):
    if s[i + j] != t[j]:
      tmp += 1
  if ret > tmp:
    ret = tmp
    
print(ret)