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:
import sys                                                                                                                               
                                                                                                                                         
S = input()                                                                                                                              
T = input()                                                                                                                              
                                                                                                                                         
##print(S)                                                                                                                               
##print(T)                                                                                                                               
                                                                                                                                         
flag = 0                                                                                                                                 
count = 0                                                                                                                                
                                                                                                                                         
##print(len(T))                                                                                                                          
tmp_len = len(T)                                                                                                                         
                                                                                                                                         
                                                                                                                                         
while 1:                                                                                                                                 
                                                                                                                                         
    ##print("")                                                                                                                          
    for i in range(0, count + 1):                                                                                                        
        tmp_st = T[i:tmp_len-count+i]                                                                                                    
        ##print(tmp_st)                                                                                                                  
        ##print(S[i:len(S)-i-1])                                                                                                         
        if tmp_st in S[i:len(S)-i]:                                                                                                      
            flag = 1                                                                                                                     
            break                                                                                                                        
                                                                                                                                         
        ##print("")                                                                                                                      
    if flag == 1:                                                                                                                        
        break                                                                                                                            
    count = count + 1                                                                                                                    
                                                                                                                                         
print(count)

Submission status: Wrong Answer

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

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

ans = []
for i in range(len(S)-len(T)+1):
    s = S[i:len(T)]
    cnt = 0
    for x, y in zip(s, T):
        if x == y:
            cnt += 1
    ans.append(cnt)
    
print(len(T)-max(ans))

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
x = len(t)
res= 0
for i in range(len(s) - x):
    tmp = s[i:x]
    cntmp = 0
    for j in range(x):
        if t[j] == s[j]:
            cntmp += 1
    res = max(res, cntmp)
print(x-res)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
l = len(T)
L = len(S)
max_ans = -1
for i in range(l):
   for j in range(L):
      if T[i] == S[j]:
         n = min(l - i - 1, L - j - 1)
         ans = 0
         for k in range(n):
            if T[i + k] == S[j + k]:
               ans += 1
         max_ans = max(ans, max_ans)
print(l - max_ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s1 = input()
s2 = input()
a = len(s2)
for x in range(len(s1)-a+1):
  s3 = s1[x:x+a]
  #print(s3)
  m = 10**18
  s = 0
  for y in range(a):
    if s3[y]!=s2[y]:
      s+=1
  m = min(m,s)
print(m)

Submission status: Wrong Answer

Solution code:
import numpy as np
S = str(input())
T = str(input())
len_T=len(T)
ls=[]
for i, t in enumerate(T):
    count = 0
    #print(i)
    for j, s in enumerate(S):
        #print(j)
        #print(t,s)
        if t == s:
            if (j - i < 0) or (len_T + j - i > len(S)):
                #print(j,i,t,s)
                continue
            else:
                #print(t,s)
                #print(j, i, t, s)
                tmp=S[j-i:len_T+j-i]
                #print(tmp)
                #print(tmp)
                for x, y in zip(tmp,T):
                    if x!=y:
                        count+=1
                ls.append(count)
                #break
#print(ls)
if len(ls)==0:
    print(len_T)
else:
    print(np.min(ls))

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
counter_dict = {}
for i in range(len(S)):
	counter = 0
	for j in range(len(T)):
		if i + j < len(S):
			if S[i + j] == T[j]:
				counter += 1
	if str(i) in counter_dict.keys():
		if counter_dict[str(i)] < counter:
			counter_dict[str(i)] = counter
	else:
		counter_dict[str(i)] = counter
max_counter = max(counter_dict.values())
print(len(T) - max_counter)

Submission status: Wrong Answer

Solution code:
s=input()
d=input()
n=len(d)
count=0
for i in range(len(d)):
	if d[:i+1] in s or d[n-i-1:] in s:
		count+=1
print(n-count)

Submission status: Wrong Answer

Solution code:
def f(l,s):
	c=0
	for i in range(len(l)):
		if l[i]==s[i]:
			c+=1
	return len(l)-c

t=input()
sub=input()
n=len(t)
m=len(sub)
c=m
for i in range(0,n-m):
	c=min(c,f(t[i:i+m],sub))
print(c)

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
R=0
while R<len(T):
  for i in range(R+2):
    for j in range(len(S)-(len(T)-R)+1):
      if T[i:i+(len(T)-R)]==S[j:j+(len(T)-R)]:
        #print(T[i:i+(len(T)-R)])
        if (j-i<0 or i+len(T)>len(S)): continue
        else: break
    else: continue
    break
  else: 
    R+=1
    continue
  break
print(R)

Submission status: Wrong Answer

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

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

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

  
print(len(t)-num)

Submission status: Wrong Answer

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

    common = 0
    max_common = 0
    len_t = len(t)
    for t_ind in range(len_t):
        for char in s:
            if common == len_t:
                break
            elif t_ind + common + 1 == len_t:
                break
            elif not common and char == t[t_ind]:
                common += 1
            elif char == t[common]:
                common += 1
            else:
                if common and common > max_common:
                    max_common = common
                common = 0
    print(len_t - max_common)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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


def main():
    probB()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

S = input()
T = input()

counter = 0
max_counter = 0

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

print(int(len(T)) - int(max_counter))

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
 
ans = 0
if T in S:
  print(ans)
  exit()
l = len(T)
for t in range(1,l):
  if ((T[t:] in S[t:]) or(T[:-1*t] in S[:-1*t])):
    ans = t
    break
 
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    s_long = input()
    s_shor = input()

    ans = len(s_shor)
    max_len = len(s_long) - len(s_shor)


    for i in range(max_len):
        cnt = 0

        for j in range(len(s_shor)):

            short = s_shor[j]
            longg = s_long[i + j]
            
            if (short != longg):
                cnt += 1
        
        ans = min(ans, cnt)
        
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

s = input()
t = input()

i, j = 0, 0
longest = 0
for i in range(len(t)):
    count = 0
    base_i = i
    for j, c in enumerate(s[base_i:]):
        if i >= len(t):
            i = base_i
#        print(base_i, i, t[i], j, c)
        if len(s[base_i+j:]) < len(t[i:]):
            break
        if t[i] == c:
            count += 1
            i += 1
            longest = max(longest, count)
        else:
            i = base_i
            count = t[i] == c
            i += count

print(len(t)-longest)

Submission status: Wrong Answer

Solution code:
import sys

s = input()
t = input()

max = 0
for i in range(0, len(s)):
    for j in range(i + 1, len(s)):
        idx = t.find(s[i:j])
        if idx != -1 and idx <= i and len(t) - (idx + (j - i)) <= len(s) - j - 1:
            if j - i > max:
                # print(max, ' ', i, ' ', j, ' ', s[i:j])
                max = j - i

# max = 0
# for length in range(1, len(s)):
#     flag = False
#     for start in range(0, len(s) - length):
#         idx = t.find(s[start:start + length])
#         if idx != -1:
#             if len(t) - (idx + length) <= len(s) - (start + length):
#                 max = length
#                 flag = True
#                 break
#     if not flag:
#         break

print(len(t) - max)

Submission status: Wrong Answer

Solution code:
from sys import stdin
rs = lambda : stdin.readline().strip()
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

def main():
    S = rs()
    T = rs()
    ans = 0
    tlen = len(T)
    for i in range(0, tlen):
        for j in range(i + 1, tlen):
            if T[i:j] in S[i:]:
                ans = max(ans, j - i)
    print(tlen - ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

def count_equals(s_, t_):
    i = 0

    for i in range(len_t):
        if s_[i] != t_[i]:
            break

    for j in range(len_t - 1, -1, -1):
        if s_[j] != t_[j]:
            break

    j = (len_t - j - 1) if 'j' in locals().keys() else 0

    return i if i > j else j

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

if len_s == len_t:
    print(len_s - count_equals(s, t))
    exit()

for i in range(0, len_s - len_t + 1):
    equals = count_equals(s[i : i + len_t], t)

    if equals > max_t:
        max_t = equals

print(len_t - max_t)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

  
print(len(t)-num)

Submission status: Wrong Answer

Solution code:
S = str(input())
T = str(input())
ans = 10000
for i in range(len(S)-len(T)+1):
    c = S[i:] 
    cnt = 0
    for j in range(len(T)):
        if str(T[j]) != str(c[j]):
            cnt += 1
    if  ans > cnt and cnt >=1:
        ans = cnt
print (ans)

Submission status: Wrong Answer

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

l_s = len(s)
l_t = len(t)

ans = l_t
if t in s:
	ans = 0
else:
	for start in range(l_t):
		for end in range(start, l_t):
			pair = t[start:end + 1]
			window = s[start:l_s - (l_t - end) + 1]
			if pair in window:
				ans = min(ans, l_t - len(pair))
			else:
				break

print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

def lev(t1, t2):
  cnt = 0
  for i in range(len(t1)):
    if t1[i] == t2[i]:
      cnt += 1
  return len(t1) - cnt

min_val = 9999
for i in range(len(s)-len(t)): # 始点
  l = lev(t, s[i:i+len(t)])
  if l < min_val:
    min_val = l

print(min_val)

Submission status: Wrong Answer

Solution code:
str = input()
part = input()

flg = False

for i in range(len(part)):
  for j in range(i + 1):
    # atcoder -> atcode
    # print(part[j:len(part)-i])
    target = str[j: -(i - j)]
    search = part[j: - (i - j)]
    if search in target:
      print(i)
      flg = True
      break
  
  if flg:
    break

if not flg:
	print(len(part))

Submission status: Wrong Answer

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

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()
lent = len(T)-1
lenan = len(longestSubstringFinder(S,T))
print(lent-lenan)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
minCount = 10000
i = 0
while i < len(s):
    countSame = 0
    j = 0
    while j < len(t) and i+j < len(s):
        if t[j] == s[i+j]:
            countSame += 1
        j += 1
        minCount = min(len(t) - countSame, minCount)
    i += 1
print(minCount)

Submission status: Wrong Answer

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

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

            max_count = max(max_count, len(T[start:end+1]))


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

Submission status: Wrong Answer

Solution code:
import numpy as np
S = input()
T = input()

tmp = np.zeros(len(T))

i=0
flg=True

while flg:
    for j in range(i, len(T)):
        if T[i:j+1] in S:
            tmp[i] = j+1-i
    i = max(i + int(tmp[i]),i+1)
    if i >= len(T)-1:
        flg=False

print(len(T)-int(np.max(tmp)))

Submission status: Wrong Answer

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


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


print(len(t)-ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
l = list()
wake = len(s)-(len(t)-1)

for i in range(wake):
  l.append(s[i:i+len(t)])
gokei = len(t)
for i in l:
  sco = len(t)
  q = 0
  for j in i:
    if j == t[q]:
      sco -= 1
    q += 1
  if gokei < sco:
    gokei = sco
    
print(sco)

Submission status: Wrong Answer

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


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


print(a())

Submission status: Wrong Answer

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

ls = len(s)
lt = len(t)

ans = 9999999
for i in range(ls-lt):

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

Submission status: Wrong Answer

Solution code:
a = list(input())
b = list(input())
min_k = len(b)
for i,k in enumerate(b):
  for j,m in enumerate(a):
    flag = True
    count=0
    if k==m:
      #print(k,m,i,j)
      s = i+1
      l = j+1
      count+=1
      if s>=len(b) or l>=len(a):
        #print('a')
        flag =False
      if i>j:
        #print('b')
        flag = False
      while flag:
        #print(b[s],a[l],i,j)
        
        if b[s]==a[l]:
          count+=1
        s = s+1
        l = l+1
        if s>=len(b) or l>=len(a):
          
          flag =False
      min_k = min(min_k,len(b)-count)
          
print(min_k)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ans = 0
for i in range(len(t)):
    if s.count(t[i:]) != 0:
        ans = (len(t[i:]))
        break
if s.count(t[:-1]) != 0:
    ans = max((len(t[1:])),ans)
print(len(t)-ans)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
import math
if T in S:
    print(0)
    exit()
for i in range(1,math.ceil(len(T)/2)):
    if T[i:] in S or T[:-i] in S:
        print(i)
        exit()
        
print(len(T)-1)

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
A=[]
t=T
while t:
    for i in range(len(t)):
        A.append(t[i:])
    t=t[:len(t)-1]
ans=len(T)
for i in A:
    if i in S and S.index(i[0])>=T.index(i[0]):
        c=len(T)-len(i)
        ans=min(ans,c)
print(ans)

Submission status: Wrong Answer

Solution code:
sList = list(input())
tList = list(input())
numList = []
 
for ti,t in enumerate(tList):
  num = 0
  for si,s in enumerate(sList):
    tnum = ti
    snum = si
    isSame = t == s
    while isSame:
      num += 1
      tnum += 1
      snum += 1
      if tnum >= len(tList): break
      if snum >= len(sList): break
      isSame = tList[tnum] == sList[snum]
  numList.append(num)
print(len(tList) - max(numList))

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

def main():
    ans = 10000
    s = input().rstrip('\n')
    t = input().rstrip('\n')
    lent = len(t)
    lens = len(s)
    tmp = 0
    for i in range(lens-lent):
        tmp = 0
        for j in range(lent):
            if s[i:i+lent][j] != t[j]:
                tmp += 1
        ans = min(ans, tmp)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
import copy
T = copy.deepcopy(t)
count1=0
count2=0
while True:
  if t in s:
    break
  else:
    t= t[:-1]
    count1+=1
while True:
  if T in s:
    break
  else:
    T = T[1:]
    count2+=1
print(min(count1,count2))

Submission status: Wrong Answer

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

if (t in s):
    print(0)

ans = 1000
for i in range(len(s)-len(t)):
    diff = 0
    for j in range(len(t)):
        if (s[i+j] == t[j]):
            pass
        else:
            diff += 1
    
    ans = min(ans, diff)

print(ans)

Submission status: Wrong Answer

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

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, len(S)-(len(T)-i-j))>=0:
            print (len(T)-i)
#            print(subst)
            exit(0)

Submission status: Wrong Answer

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

suma=0
sumb=0

for i in range(len(T)):
    A = T[i:]
    B = T[:i+1]
    if A in S:
        pass
    else:
        suma+=1

    if B in S:
        pass
    else:
        sumb+=1

if suma>sumb:
    print(sumb)
else:
    print(suma)

Submission status: Wrong Answer

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

    common = 0
    max_common = 0
    for t_ind in range(len(t)):
        for char in s:
            if common == len(t):
                break
            elif not common and char == t[t_ind]:
                common += 1
            elif char == t[common]:
                common += 1
            else:
                if common and common > max_common:
                    max_common = common
                common = 0
    print(len(t) - max_common)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

l_s = len(s)
l_t = len(t)

res = l_t
for i in range(l_s - l_t):
    cnt = 0
    for j in range(l_t):
        if t[j] != s[i+j]:
            cnt+=1
    if res > cnt:
        res = cnt
print(res)

Submission status: Wrong Answer

Solution code:
import sys

S = input()
T = input()

##print(S)
##print(T)

flag = 0
count = 0

##print(len(T))
tmp_len = len(T)


while 1:

    ##print("")
    for i in range(0, count + 1):
        tmp_st = T[i:tmp_len-count+i]
        ##print(tmp_st)
        ##print(S[i:len(S)-i-1])
        if tmp_st in S[i:len(S)-i-1]:
            flag = 1
            break
        
        ##print("")
    if flag == 1:
        break
    count = count + 1

print(count)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
l = len(T)
ans = l
for i in range(l):
  for j in range(l):
    if (i<=j):
      if T[i:j+1] in S:
        f = S.find(T[i:j+1])
        if f >= i and f + (l-j) <= len(S):
          ans = min(ans, l - (j+1-i))
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
counter_dict = {}

for i in range(len(S)):
	counter = 0
	for j in range(len(T)):
		if i + j < len(S):
			if S[i + j] == T[j]:
				counter += 1
	if str(i) in counter_dict.keys():
		if counter_dict[str(i)] < counter:
			counter_dict[str(i)] = counter
	else:
		counter_dict[str(i)] = counter
max_counter = max(counter_dict.values())
print(len(T) - max_counter)

Submission status: Wrong Answer

Solution code:

S = input()
T = input()

Slen = len(S)
Tlen = len(T)
i = 0

while i < Tlen:
    if T[i:] in S[i:]:
        break
    if T[:(Tlen-i)] in S[:(Slen-i)]:
        break
    i += 1

if i != Tlen:
    print(i)
else:
    print(Tlen)

Submission status: Wrong Answer

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

ans = []
counter = 0
for i, j in zip(s, t):
    if i != j:
        ans.append(j)

print(len(ans))

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
ans = 0
c = 0
m = 1001

for i in range(len(s)-len(t)+1):
    tmp = s[i:i+len(t)]
    #print(tmp)
    for j in range(len(t)):
        #print(tmp[j],t[j])
        if tmp[j] != t[j]:
            c+=1
        #print(c)
    if m > c:
        ans = c
    c=0

print(ans)

Submission status: Wrong Answer

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

    if T in S:
        print(0)
        return

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

def main():
    probB()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
i = 0
min = len(S)
#print(S[2])
if(T in S):
    print("0")
while(i < len(S)-len(T)):
    count = 0
    for j in range(len(T)):
        if(T[j] == S[j + i]):
            count+=1
    if(count <= min and count != 0):
        min = count
    i+=1
print(min)

Submission status: Wrong Answer

Solution code:
# vim: fileencoding=utf-8


def main():
    s = input()
    t = input()
    lt = len(t)
    ans = lt
    for i in range(0, len(s) - lt + 1):
        sub = s[i : i + lt]
        c = 0
        for j in range(0, lt):
            if sub[j] != t[j]:
                c += 1
        if ans > c:
            ans = c
    print(c)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

for i in range(len(s)):
  m = i
  a = 0

  for j in range(len(t)):
    if i < j:
      break
    
    if len(s) - i < len(t) - j:
      continue    
     
    # if m > len(s) - 1:
    #   break

    if s[m] == t[j]:
      a += 1
      m += 1
      if max < a:
        max = a
    else:
      a = 0
      m = i

print(len(t) - max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
import math
if T in S:
    print(0)
for i in range(1,math.ceil(len(T)/2)):
    if T[i:] in S or T[:-i] in S:
        print(i)
        exit()
print(len(T)-1)

Submission status: Wrong Answer

Solution code:
import re

S = input()
T = input()
k = 0 

if re.search(T, S):
    print(0)
else:
    for i in S:
        k +=1
        if re.search(T[0:len(T)-(k+1)], S):
            break
        
    
    print(k)

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
max_length = 0
for i in range(len(t)):
    for j in range(i, len(s)):
        if t[i] == s[j]:
            length = 0
            for k in range(min(len(t)-i, len(s)-j)):
                if t[i+k] == s[j+k]:
                    length += 1
            for l in range(1, i+1):
                if t[i-l] == s[j-l]:
                    length += 1
            if length > max_length:
                max_length = length
print(len(t)-max_length)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
mm = 0
for i in range(len(S)-len(T)):
    a = S[i:i+len(T)]
    mm_now = sum([x == y for x,y in [*zip(a,T)]])
    mm = max(mm_now, mm)
print(len(T) - mm)

Submission status: Wrong Answer

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

def count_ans(a,b):    
    ans = 0
    for k in range(len(a)):
        for l in range(len(b)-k):
            if k==l and a[k]==b[l]:
                ans += 1
    return ans

ans = 0
for i in range(len(s)-len(t)+1):
    Ans = count_ans(s[i:i+len(t)],t)
    if ans < Ans:
        ans = Ans

print(len(t)-ans)

Submission status: Wrong Answer

Solution code:
def resolve():
    s = input()
    t = input()
    ans = 0

    for i in range(len(t)):
        for j in range(i, len(t)):
            test = t[i:j+1]

            if test in s[i:len(s)-(len(t)-j)]:
                ans = max(ans, len(test))

    print(len(t)-ans)
resolve()

Submission status: Wrong Answer

Solution code:
import re
import sys
s = input()
t = input()
t1 = t
t2 = t
for i in range(len(t)):
  if  re.search(t,s) != None:
    print(0)
    sys.exit()
  t1 = t1[1:]
  t2 = t2[:len(t2)]
  if None!=re.search( ".+"+t1+".+",s):
    print(i+1)
    sys.exit()
  if None!=re.search( ".+" + t2 + ".+",s):
    print(i+1)
    sys.exit()
    
  if i == len(t)-1:
    
    print(len(t))

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
q = [len(t)]

for i in range(0,len(t)):
    for j in range(i+1,len(t)+1):
        if s[i:j] in t and len(s[:j]) >= len(t):
            q.append(len(t)-j+i)
            #print(s[i:j], len(t)-j+i)
        
print(sorted(q)[0])

Submission status: Wrong Answer

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

s_num = len(s)
t_num = len(t)

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

print(t_num - count)

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
lens=len(s)
lent=len(t)

mxcnt=0
for i in range(lens-lent+1):
  cnt=0
  for j in range(lent):
    if  s[i+j]==t[j]:
      cnt+=1
      mxcnt=max(mxcnt,cnt)
    else:
      cnt=0
print(lent-mxcnt)

Submission status: Wrong Answer

Solution code:
from collections import deque

def main():
    import sys
    input = sys.stdin.readline

    S = input()
    T = input()

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

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

    ans = len_T
    for i in range(len_S - len_T +1):
        cnt = len_T
        for j in range(len_T):
            if(S[i+j] != T[j]):
                cnt -= 1
        # print(cnt)
        # print(ans)
        ans = min(ans, len_T-cnt)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
moji=""
for i in range(len(t)):
    moji=t[:-1*i]
    #print(moji)
    if s.find(moji)!=-1:
        #print(len(t)-i)
        ans=len(t)-1
print(ans)

Submission status: Wrong Answer

Solution code:
S,T = input(),input()
ans = len(T)

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

Submission status: Wrong Answer

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

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

count1=0 
while 1:
    if t in s:
        break
    t=t[1:]
    count1+=1

count2=0
while 1:
    if z in s:
        break
    z=z[:-1]
    count2+=1
print(min(count1,count2))