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: Runtime Error

Solution code:
import re

S = input()
T = input()

start = time.time()

ans_list = []

a = '.'*len(T)

for i in range(len(T)):
    if i == 0:
        b = T[i] + a[i+1:]
    elif i == len(T)-1:
        b = a[:i] + T[i]
    else:
        b = a[:i] + T[i] + a[i+1:]
    s = re.findall(b, S)
    
    if len(s) >= 1:
        for j in range(len(s)):
            c = list(s[j])
            d = list(T)
            ans = 0
            for k in range(len(c)):
                if c[k] == d[k]:
                    ans += 1
            ans_list.append(ans)
    else:
        pass

print(len(T) - max(ans_list))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S, T = input().split()
 
n = len(S) - len(T) + 1
min = len(T)
 
for a in range(n):
  count = 0 
	for b in range(len(T)):
      if S[a+b] != T[b]:
        count += 1
  if count < min:
    min = count
print(min)

Submission status: Runtime Error

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

a = []
sum_ = 0
for i in range(ls-lt+1):
    ss = s[i:i+lt]
    sum_ = 0
    for i, alb in enumerate(lt):
        if alb == ss[i]:
            sum_+= 1
    a.append(sum_)

print(lt - max(a))

Submission status: Runtime Error

Solution code:
T,S=input().split()

Tlist=list(T)
Slist=list(S)

TL=len(Tlist)
SL=len(Slist)

c=0
ans=SL

if S in T :
    ans=0
else:
    for i in range(TL-SL):
        for j in range(SL):
            if Tlist[j+i]!=Slist[j]:
                c=c+1
        if ans>c:
            ans=c
        c=0
            
        
print(ans)

Submission status: Runtime Error

Solution code:
s = input().split()

n = len(s[0]) - len(s[1]) + 1
min = len(s[1])
 
for a in range(n):
  count = 0 
	for b in range(len(s[1])):
      if s[0][a+b] != s[1][b]:
        count += 1
  if count < min:
    min = count
print(min)

Submission status: Runtime Error

Solution code:
s = input()
t = input()
counts = list()
for i in range(len(t)):
    count = len(t)
    kari_count = len(t)
    for j in range(len(s)):
        if((len(s) - j + 2) == (len(t) - i )):
            break
        if(j < i):
            continue
        elif(t[i] == s[j]):
            kari_count = i 
            for k in range(len(t) - i):
                if(t[i + k] == s[j + k]):
                    continue
                else:
                    kari_count += 1
        elif(kari_count < count):
            count = kari_count
        else:
            continue
    counts.append(count)
print(min(counts))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S, T = input().split("\n")
for i in range(len(T)):
  k=int(len(T)//i
  for j in range(k):             
    if S[k-1:k-1+j] in T:
        p=j
        continue
    else: break
  answer = len(S)-p
  print(answer)

Submission status: Runtime Error

Solution code:
s=str(input())
t=str(input())
ans=0
f=[]
g=len(s)
h=len(t)
n=g-h
for i in range(n):
    for j in range(h):
        if s[i+j]!=t[j]:
            ans+=1
    f.append(ans)
    ans=0
    f.sort()
print(f[0])

Submission status: Runtime Error

Solution code:
x = [input() for i in range(2)]
S = list(x[0])
T = list(x[1])

n = int(len(S)) - int(len(T)) + 1
min = int(len(T))
 
for a in range(n):
  count = 0 
	for b in range(int(len(T))):
      if S[a+b] != T[b]:
        count += 1
  if count < min:
    min = count
print(min)

Submission status: Runtime Error

Solution code:
import sys

s = input()
t = input()

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

s1={i for i in a}
s2={i for i in b}
if len(s1&s2)==0:
  print(len(t))
  sys.exit()

unmatch=10000

for i in range(len(t)):

  for j in range(i,len(s)-(len(t)-i-1)):

    if t[i] == s[j]:
      buf=i
      for l in range(len(t)-i-1):
        if t[i+l+1] != s[j+l+1]:
          buf+=1
          
      if buf < unmatch:
        unmatch=buf
if unmatch==10000:
  print(len(t))
else:
  print(unmatch)

Submission status: Runtime Error

Solution code:

T,S=input().split()

Tlist=list(T)
Slist=list(S)

TL=len(Tlist)
SL=len(Slist)

c=0
ans=SL

if S in T :
    ans=0
else:
    for i in range(TL-SL):
        for j in range(SL):
            if Tlist[j+i]!=Slist[j]:
                c=c+1
        if ans>c:
            ans=c
        c=0
            
        
print(ans)

Submission status: Runtime Error

Solution code:
import re

S, T = [str(input()) for _ in range(2)]

index_list = []
count_list = []

match_count = 0

if T in S:
  print(0)
else:
  index = 0
  counter = 0
  for s in S:
    for m in re.finditer(str(s), str(T)):
      if index >= m.start():
        if m.start() - 1 in index_list:
          counter += 1
        else:
          count_list.append(counter)
          counter = 1
    index_list = []
    index_list.append(m.start())
    index += 1
  if len(count_list) == 0:
    print(len(T))
  else:
    print(len(T)-max(count_list))

Submission status: Runtime Error

Solution code:
S,T = input.split()
for i in S:
  for j in T:
    if i == j:
      k +=1

Submission status: Runtime Error

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-i):
      ans = 0
      if T[i+j] == S[j]:
         ans += 1
   max_ans = max(max_ans, ans)
for i in range(L - l):
   for j in range(l):
      ans = 0
      if T[j] == S[j+i]:
         ans += 1
      max_ans = max(max_ans, ans)
for i in range(l):
    for j in range(i):
       if T[i-j] == S[L-j]:
          ans +=1
       max_ans = max(max_ans, ans)
print(l - max_ans)

Submission status: Runtime Error

Solution code:
import re
S = input()
T = input()
ast = []
for i in range(len(T)):
    stra = ""
    for k in range(i):
        stra = stra + "."
        ast.append(stra)
flag = False
if T in S:
    print(0)
else:
    for i in range(1, len(T) + 1):
        if flag:
            break
        for s in range(len(T) + 1 - i):
            Tc = T

            Tc = Tc.replace(Tc[s:s+i], ast[i])
            if len(re.findall(Tc, S)) != 0:
                print(i)
                flag = True
                break

Submission status: Runtime Error

Solution code:
x = [input() for i in range(2)]
S = list(x[0])
T = list(x[1])
n = 0
n = len(S) - len(T) + 1
min = len(T)
 
for a in range(n):
  count = 0 
	for b in range(len(T)):
      if S[a+b] != T[b]:
        count += 1
  if count < min:
    min = count
print(min)

Submission status: Runtime Error

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

L = len(S)
l = len(T)

r = []
for i in range(L - l):
    x = 0
    for k in range(i, i + l):
        if S[k] == T[k - i]:
            x += 1
        else:
            x += 0
    r.append(x)

y = max(r)
print(l - y)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
S = input()
T = input()
score_list = []
for i in range(len(S) - len(T)):
  s = S[i:i+len(T)]
  score = 0
  for i in range(len(s)):
    if s[i] != T[i]:
      score += 1
  score_list.append(score)
print(min(score_list))

Submission status: Runtime Error

Solution code:
T,S=input().split()

Tlist=list(T)
Slist=list(S)

TL=len(Tlist)
SL=len(Slist)

c=0
ans=SL

if S in T :
    ans=0
else:
    for i in range(TL-SL):
        for j in range(SL):
            if Tlist[j+i]!=Slist[j]:
                c=c+1
        if ans>c:
            ans=c
    c=0
                 
print(ans)

Submission status: Runtime Error

Solution code:
#include <stdio.h>
#include <string.h>

int main(void){
    char s[1000];
    char t[1000];
    scanf("%s",s);
    scanf("%s",t);
    int m[strlen(s)];
    for(int i = 0; i < strlen(s); i++){
        m[i] = 0;
    }
    for(int i = 0; i < strlen(s); i++){
        for(int j = 0; j < strlen(t); j++){
            if(s[i] == t[j] && i>=j && strlen(s)-i>=strlen(t)-j){
                for(int k = j; k < strlen(s); k++){
                    if(s[i+k-j] == t[k]){
                        m[i]++;
                    }
                    else{
                        break;
                    }
                }
            }
        }
    }
    int max = 0;
    for(int i = 0; i < strlen(t); i++){
        if(max < m[i]){
            max = m[i];
        }
    }
    printf("%d",strlen(t)-max);
    return 0;
}

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    s = input()
    t = input()
    if t in s:
        print(0)
        sys.exit()
    lent = len(t)
    lens = len(s)
    res = []
    for i1 in range(lent):
        for i2 in range(lent, i1, -1):
            end = lens - (lent - i2)
            if t[i1:i2] in s[i1:end]:
                res.append(i1 + (lent - i2))

    r = min(res)
    print(r)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

L = len(S)
l = len(T)

r = []
for i in range(L - l):
    x = 0
    for k in range(i, i + l):
        if S[k] == T[k - i]:
            x += 1
    r.append(x)

y = max(r)
print(l - y)

Submission status: Runtime Error

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

r = len(s) - len(t)
l = []
for start in range(r):
    count = 0
    for i in range(len(t)):
        if t[i] == s[start+i]:
            count +=1
    l.append(count)
ans = len(t)- max(l)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(len(tList) - max(numList))

Submission status: Runtime Error

Solution code:
x = input().split()
S = list(x[0])
T = list(x[1])
n = 0
n = len(S) - len(T) + 1
min = t
 
for a in range(n):
  count = 0 
	for b in range(len(T)):
      if S[a+b] != T[b]:
        count += 1
  if count < min:
    min = count
print(min)

Submission status: Runtime Error

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

for i in range(len(T)+1):
    lT = len(T)-i+1
    sT = 0
    while lT != len(T)+1:
        print(T[sT:lT])
        print(S[sT:len(S)])
        print(T[sT:lT] in S[sT:len(S)])
        if T[sT:lT] in S[sT:len(S)]:
            print(i-1)
            exit()
        else:
            sT += 1
            lT += 1

print(len(T)+1)

Submission status: Runtime Error

Solution code:
x = input().split()
S = list(x[0])
T = list(x[1])
s = len(S)
t = len(T)
n = 0
n = s - t + 1
min = t
 
for a in range(n):
  count = 0 
	for b in range(t):
      if S[a+b] != T[b]:
        count += 1
  if count < min:
    min = count
print(min)

Submission status: Runtime Error

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

for i in range(1000):
  try:
    k=S[i]
  except IndexError:
    Slen=i
    break
for j in range(1000):
  try:
    k=T[j]
  except IndexError:
    Tlen=j
    break

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

Submission status: Runtime Error

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

n_s = len(S)
n_t = len(T)

t = T[0:n]
# A = []
boolean = False

for i in range(n_t):
  for j in range(0,i+1):
    t = T[j:(j+n_t-i)]
    # A.append(t)
    i_s = S.find(t)
    i_t = T.find(t)
    # print(t,i_t,i_s,len(T[i_t:]),len(T[i_s:]) )
    if t in S:
      if (i_t <= i_s) and (len(T[i_t:]) <= len(S[i_s:])):
        print(i)
        boolean = True
        break
  else:
    continue
  break

if not (boolean):
  print(n_t)

Submission status: Runtime Error

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

def x():
    for i in range(len(T),0,-1): # 文字列の長さ
        for j in range(len(T)-i): # T検索の開始位置=その前にある文字数
            t=T[j:i+j]
            for m in re.finditer(t, S):
                p=m.start()
                if p!=-1:
                    if j<=p and len(T)-j-1 <=len(S)-p-1:
                        return i
    return 0
print(len(T)-t)

Submission status: Runtime Error

Solution code:
#S, T = [str(i) for i in input().split()]
x = input().split()
S = x[0]
T = x[1]
s = list(S)
t = list(T)
s_n = len(s)
t_n = len(t)
n = 0
n = s_n - t_n + 1
min = t_n
 
for a in range(n):
  count = 0 
	for b in range(t_n):
      if S[a+b] != T[b]:
        count += 1
  if count < min:
    min = count
print(min)

Submission status: Runtime Error

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

@author: naoki
"""
import sys 

sys.setrecursionlimit(10**8)

S = input()
T = input()
count = [0 for i in range(len(S)-len(T))]

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

count = sorted(count)

print(count[0])

Submission status: Runtime Error

Solution code:
s = input()
t = input()
i = 0
for ind, x in enumerate(s):
  if x==t[0]:
    i = ind
y = 0
cnt= 0
for x in s[i:]:
  if x!=t[y]:
    cnt+=1
  y+=1
print(cnt)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
P = [input().split() for i in range(M)]

S = P[0]
T = P[1]

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

max_y = 0

for x in range(s_len - t_len):

    y = 0
    for t in T:
        if t == S[x]:
            y = y+1
            x = x+1
        else:
            x = x+1

    if max_y <= y:
        max_y = y

print(t_len - max_y)

Submission status: Runtime Error

Solution code:
import Levenshtein

s = input()
t = input()

print((Levenshtein.distance(s, t)) / 3)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()
T = input()
Sli = list(S)
Tli = list(T)
cli = []

for i in range(len(Sli) - len(Tli)):
    c = len(Tli)
    for j in range(len(Tli)):
        if Sli[i + j] == Tli[j]:
            c -= 1
    cli.append(c)

print(min(cli))

Submission status: Runtime Error

Solution code:
S, T = [str(i) for i in input().split()]
 
#s = list(S)
#t = list(T)
#s_n = len(s)
#t_n = len(t)
#n = 0
#n = s_n - t_n + 1
#min = t_n
 
#for a in range(n):
  #count = 0 
	#for b in range(t_n):
      #if S[a+b] != T[b]:
        #count += 1
  #if count < min:
    #min = count
      
#print(min)

Submission status: Runtime Error

Solution code:
from difflib import SequenceMatcher
S = input()
T = input()
s = SequenceMatcher(None, T, S)
print(len(T) - s.find_longest_match(0, 3, 0, 6)[2])

Submission status: Runtime Error

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

print(s)
a = len(s)
b = len(t)
c = a-b;
min1 = 0;
min2 = 0;
for i in range(c):
  for j in range(b):
    if s[j]==t[i+j]:
      min2 += 1
  if min1>min2:
    min1 = min2
print(min1)

Submission status: Runtime Error

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

@author: naoki
"""
import sys 

sys.setrecursionlimit(10**6)

S = input()
T = input()
count = [0 for i in range(len(S)-len(T))]

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

count = sorted(count)

print(count[0])

Submission status: Runtime Error

Solution code:
s = input()
t = input()
if t in s:
    print(0)
else:
    ans = len(t)
    for i in range(len(t)):
        for j in range(len(s)):
            if t[i] == s[j]:
                if ((len(t) - i) <= (len(s) - j)) and i <= j:
                    k = i + 1
                    l = j + 1
                    cnt1 = 0
                    while k < len(t):
                        if t[k] != s[l]:
                            cnt1 += 1
                        k += 1
                        l += 1
                    k = i - 1
                    l = j - 1
                    cnt2 = 0
                    while k >= 0:
                        if t[k] != s[l]:
                            cnt2 += 1
                        k -= 1
                        l -= 1
                    ans = min(ans, cnt1 + cnt2)  
                else:
                  if (len(t) - i) > (len(s) - j)):
                    break
               
    print(ans)

Submission status: Runtime Error

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

A = itertools.combinations(list(range(len(t)+1)),2)
for i in A:
    part = t[i[0]:i[1]]
    if part in s:
        ans = len(part)
        
print(len(t) - ans)

Submission status: Runtime Error

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

tmp = np.array(tmp, dtype=int)
i = np.argmax(tmp)
j = tmp[i]
s = S.find(T[i:i+j])
if s - i >= 0 and s - i + len(T) <= len(S):
    print(len(T)-int(np.max(tmp)))
else:
    l=0
    for k in range(len(T)):
        if S[s+k] == T[k]:
            l+=1
    print(len(T)-l)

Submission status: Runtime Error

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

A = itertools.combinations(list(range(len(t)+1)),2)
for i in A:
    part = t[i[0]:i[1]]
    if part in s:
        ans = len(part)
        
print(len(t) - ans)

Submission status: Runtime Error

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

cnt = []
for i in range(len(t)):
    for k in range(i + 1, len(t) + 1):
        if t[i:k] in s[i:]:
            cnt.append(k - i)
            print(t[i:k], k - i)
#print(cnt)
print(len(t) - max(cnt))

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from itertools import combinations_with_replacement
def main():
    s = input()
    t = input()
    if t in s:
        print(0)
        sys.exit()
    lent = len(t)
    com = combinations_with_replacement(range(lent+1), 2)
    res = []
    for come in com:
        tmp = t[come[0]:come[1]]
        if tmp:
            if tmp in s[come[0]:come[1]+1]:
                res.append(lent - len(tmp))
    r = min(res)
    print(r)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
S, T = [str(i) for i in input().split()]
 
s = list(S)
t = list(T)
s_n = len(s)
t_n = len(t)
n = 0
n = s_n - t_n + 1
min = t_n
 
for a in range(n):
  count = 0 
	for b in range(t_n):
      if S[a+b] != T[b]:
        count += 1
  if count < min:
    min = count
      
print(min)

Submission status: Runtime Error

Solution code:
s=input()
t=input()
S=[]
c=0
for i in range(len(s)):
    if s[i] in t:
        c+=1
        p=len(t)-1
        q=t.index(s[i])
      
        if q>i or i-q+p+1>len(s):
            pass
        else:
            s1=s[i-q:i+p-q+1]
           
            count=0
            for j in range(len(s1)):
                
                if s1[j]!=t[j]:
                    count+=1
                else:
                    pass
            S.append(count)
    else:
        pass
if c==0:
    print(len(t))
else:
    print(min(S))

Submission status: Runtime Error

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

A = itertools.combinations(list(range(len(t)+1)),2)
for i in A:
    part = t[i[0]:i[1]]
    print(part)
    if part in s:
        ans = len(part)
        
print(len(t) - ans)

Submission status: Runtime Error

Solution code:
ST = [input() for i in range(2)]
S = ST[0]
T = ST[1]
num = []
for i in range(len(T)):
    _T = T[i:]
    for j in range(len(T)-i):
        _T_ = _T if j == 0 else _T[:-j]
        base = S[i:-j] if j != 0 else S[i:]
        if _T_ in base:
            num.append(len(T)-len(_T_))
print(min(num))

Submission status: Runtime Error

Solution code:
s = input()
t = input()
strs = []
t_size = len(t)
for i in np.arange(len(s)-len(t)+1):
    strs.append(s[i:i+t_size])
n = 0
max_n = 0
for ss in strs:
    for i in np.arange(len(t)):
        if t[i]==ss[i]:
            n += 1
        else:
            n = 0
        if max_n < n:
            max_n = n
print(len(t)-max_n)

Submission status: Runtime Error

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

t_list = list(t)
count_list = []



for i in range(len(s)-len(t)+1):


    string_first = s[i:len(t)+i]
    list_string = list(string_first)
    count = 0



    for k in range(len(t)):
        if t_list[k] == list_string[k]:
            count += 1
            count_list.append(count)


print(len(t)-max(count_list))

Submission status: Runtime Error

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

A = itertools.combinations(list(range(len(t)+1)),2)
for i in A:
    part = t[i[0]:i[1]]
    print(part)
    if part in s:
        ans = len(part)
        
print(len(t) - ans)

Submission status: Runtime Error

Solution code:
S = str(input())
T = str(input())
mini = []
for i in range(len(S) - len(T)):
    count = 0
    for j in range(len(T)-1):
        if T[j] == S[j+i]:        
            count+=1
    mini.append(len(T) - count)
print(min(mini))

Submission status: Runtime Error

Solution code:
S=raw_input("Enter String:")
T=raw_input("Enter String:")
if(string.find(S)==-1):
      print("Substring not found in string!")
else:
      print("Substring in string!")

Submission status: Runtime Error

Solution code:
s = input()
t = input()
n = 0
max_n = 0
for ss in strs:
    for i in np.arange(len(t)):
        if t[i]==ss[i]:
            n += 1
        else:
            n = 0
        if max_n < n:
            max_n = n
print(len(t)-max_n)

Submission status: Runtime Error

Solution code:
S, T = [str(i) for i in input().split()]

s = list(S)
t = list(T)
s_n = len(S)
t_n = len(T)
n = 0
n = s_n - t_n + 1
min = t
 
for a in range(n):
  count = 0 
	for b in range(t_n):
      if S[a+b] != T[b]:
        count += 1
  if count < min:
    min = count
      
print(min)

Submission status: Runtime Error

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

    if T in S:
        print(0)
        sys.exit()
    len_s = len(S)
    len_t = len(T)
    diff = len_s - len_t
    match_list = []
    for i in range(diff):
        cnt_match = 0
        for j in range(len_t):
            if S[j + i] == T[j]:
                cnt_match+=1
        match_list.append(cnt_match)
    # print(match_list)
    # print(len_t)
    # print(max(match_list))
    print(len_t - max(match_list))
    # 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)
    # if min(ushiro,mae) == 0:
    #     print(0)
    #     sys.exit()

    # 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: Runtime Error

Solution code:
S = str(input())
T = str(input())
fg = 0
mini = []
for i in range(len(S) - len(T)):
    count = 0
    for j in range(len(T)):
        if T[j] == S[j+i]:        
            count+=1
    mini.append(len(T) - count)
print(min(mini))

Submission status: Runtime Error

Solution code:
import sys

if __name__ == '__main__':
    S = sys.stdin.readline().rstrip()
    T = sys.stdin.readline().rstrip()
    max_match = 0
    for i in range(len(T)):
        for j in range(i+1, len(T)):
            # pos = S[i:-j].find(T[i:j])
            pos = S[i:-(len(T)-j)].find(T[i:j])
            print(S[i:-(len(T)-j)], T[i:j])
            if max_match < j-i and pos != -1:
                print(i, j)
                max_match = j - i
    # print(T, len(T))
    # print(len(T), max_match, len(T)-max_match)
    print(len(T)-max_match)

Submission status: Runtime Error

Solution code:
S, T = input().split()

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

max_y = 0

for x in range(s_len - t_len):

    y = 0
    for t in T:
        if t == S[x]:
            y = y+1
            x = x+1
        else:
            x = x+1

    if max_y <= y:
        max_y = y

print(t_len - max_y)

Submission status: Runtime Error

Solution code:
S = input()
T = input()
x = 0
y = 0
for i in range(len(S)):
  if T[0] == S[i]:
    x += (i+1)
    break
  else:
    pass
for r in range(int(len(T)-1)):
  if T[int(r+1)] == S[int(r+x)]:
    pass
  else:
    y += 1
print(y)

Submission status: Runtime Error

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

for i in range(1000):
  try:
    k=S[i]
  except IndexError:
    Slen=i
    break
for j in range(1000):
  try:
    k=T[j]
  except IndexError:
    Tlen=j
    break
lists=[]
for i in range(Slen-Tlen):
  s=0
  for j in range(Tlen):
    if S[i+j]==T[j]:
      s+=1
    else:
      continue
  t=min(t,Tlen-s)
print (t)

Submission status: Runtime Error

Solution code:
s=str(input())
t=str(input())
ans=0
f=[]
g=len(s)
h=len(t)
for i in range(g-h):
    for j in range(h):
        if s[i+j]!=t[j]:
            ans+=1
    f.append(ans)
    ans=0
    f.sort()
print(f[0])

Submission status: Runtime Error

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

cnt = []
for i in range(len(t)):
    for k in range(i + 1, len(t)):
        if t[i:k] in s[i:]:
            cnt.append(k - i)
            #print(t[i:k])
#print(cnt)
print(len(t) - max(cnt))

Submission status: Runtime Error

Solution code:
s=input()
t=input()
sz=len(t)
ans=100000000000
for i in range(0,len(s)-sz):
    k=s[i:i+sz]
    c=0
    for j in range(sz):
        if k[j]==t[j]:
            c+=1
        else:
            ans=min(ans,sz-c)
    # print(c)
ans=min(ans,sz-c)
print(ans)

Submission status: Runtime Error

Solution code:
s=str(input())
t=str(input())
ans=0
f=[]
g=len(s)
h=len(t)
for i in range(g-h):
    for j in range(h):
        if s[i+j]!=t[j]:
            ans+=1
    f.append(ans)
    ans=0
f.sort()
print(int(f[0]))

Submission status: Runtime Error

Solution code:
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) ]))
def invr():
    return(map(int,input().split()))
  
I = input()
first = s[0]
second = s[1]
 
vec = c()
i=0
while len(vec)==0 & i < len(second)-1:
  j = len(second)- i
  for k in range(1,i+1)
     sub = second[k:j+k]
     n = first.find(sub)
      if n!= -1:
        vec = c(vec, i)
  i=i+1
 
print(i-1)

Submission status: Runtime Error

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


if len(S) ==1:
    if S==T:
        print(0)
    else:
        print(1)

else: 
    l=[]
    for i in range(len(S)-len(T)+1):
        A=S[i:i+(len(T))]
        #print(A)
        count=0
        for j in range(len(A)):   
            if A[j] == T[j]:
                count+=1
                #print(count)
                l.append(count)
            
    #print(l)
    a=len(T)-max(l)
    print(a)

Submission status: Runtime Error

Solution code:
S = input()
T = input()
LS = len(S)
LT = len(T)
L = []

if T in S:
  print(0)
else:
    for ls in range(LS - LT):
        d = 0
        for lt in range(LT):
            if S[ls + lt] != T[lt]:
                d += 1
        L.append(d)
    print(min(L))

Submission status: Runtime Error

Solution code:
from difflib import SequenceMatcher
s, t = map(str, input().split())
match = SequenceMatcher(None, s, t).find_longest_match(0, len(s), 0, len(t))
ans = len(t) - match.size
print(ans)