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:
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:
  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, T = [str(i) for i in input().split()]
 
s = len(S)
t = len(T)
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:
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:
                res.append(sum(come))
    res.sort()
    r = res[1]
    print(r)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
s=str(input())
t=str(input())
ans=0
f=[]
r=0
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
        else:
            r=+1
    f.append(ans)
    ans=0
f.sort()
print(f[0])

Submission status: Runtime Error

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

suma=0
sumb=0
sumc=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 A in S:
        if B in S:
            pass
    else:
        sumc+=1


suma = min(suma, sumb)
suma = min(suma, sumc)
print(suma)
~

Submission status: Runtime Error

Solution code:
s = input()

t = input()

sub_strings = []

for i in range(len(t)):
    num_strings = len(t) - i

    for j in range(i + 1):
        sub_strings.append({'start': j, 'string': t[j:j + num_strings]})

ans_sub = ''

for sub_string in sub_strings:
    j = sub_string['start']
    sub = sub_string['string']
    if sub in s[j:]:
        ans_sub = sub
        break

print(len(t) - len(ans_sub))
s = input()

t = input()

sub_strings = []

for i in range(len(t)):
    num_strings = len(t) - i

    for j in range(i + 1):
        sub_strings.append({'start': j, 'string': t[j:j + num_strings]})

ans_sub = ''

for sub_string in sub_strings:
    j = sub_string['start']
    sub = sub_string['string']
    if sub in s[j:]:
        ans_sub = sub
        break

print(len(t) - len(ans_sub))

Submission status: Runtime Error

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

c = []
for i in range(len(s) - len(t) + 1):
    count = 0
    for j in range(len(t)):
        if s[j+i] == t[j]:
            if flag:
                count += 1
            else:
                count = 1
            flag = True
        else:
            flag = False
    c.append(count)

print(len(t) - max(c))

Submission status: Runtime Error

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

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+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()

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

r = []
for i in range(L - l):
    x = 0
    for k in range(i, i + l - 1):
        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())
n=len(t)
m=len(s)
for i in range(n):
    l=n-i
    for j in range(i+1):
        print(t[j:j+l],i,s[j:j+m-i])
        if ''.join(t[j:j+l]) in ''.join(s[j:j+m-i]):
            print(i)
            exit()
print(n)

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:
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:
  j = len(second)- i
  for k in range(1,i+1)
     sub = second[k-1:j+k-1]
     n = first.find(sub)
      if n!= -1:
        vec = c(vec, i)
  i=i+1

pointless = i-1
print(pointless)

Submission status: Runtime Error

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

if len(tList) - max(numList) > 0:
  print(len(tList) - max(numList))
else:
  print(0)

Submission status: Runtime Error

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

x = [0]
a = 0
for i in range(len(s)):
    if((s[i] == t[0]) and ((len(s)-i) >= (len(t)-1))):
        a += 1
        for k in range(1,len(t)):
            if(s[i+k] == t[k] and (s[i+k-1] == t[k-1])):
                a += 1
    x.append(a+1)
    a = 0

y = max(x) 
print((len(t) - y))

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:
  j = len(second)- i
  for k in range(1,i+1)
     sub = second[i-1:i+k-1]
     n = first.find(sub)
      if n!= -1:
        vec = c(vec, i)
  i=i+1

pointless = i-1
print(pointless)

Submission status: Runtime Error

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

@author: naoki
"""

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()
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:ls + LT] != T[lt]:
                d += 1
        L.append(d)
    print(min(L))

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

char s[1111], t[1111];

int main(void)
{
	int i, j, ans = 1000;

	scanf("%s %s", s + 1, t + 1);

	int n = strlen(s + 1);
	int m = strlen(t + 1);

	for (i = 1; i <= n - m + 1; i++)
	{
		int p = 0;

		for (j = i; j <= i + m - 1; j++)
			if (s[j] != t[j - i + 1])
				p++;

		ans = min(ans, p);
	}

	printf("%d", ans);
	return 0;
}

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))

sums = 0
for i in range(n-1):
    for j in range(i+1, n):
        sums += (a[i] * a[j])

print(sums % (10 ** 9 + 7))

Submission status: Runtime Error

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

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()

mS = []
d = len(S) - len(T)


for j in range(d):
    m = 0
    for i in range(len(T)):
        if S[i] != T[i] :
            m += 1

    mS.append(m)
    S = S[1:]
print(min(mS))

Submission status: Runtime Error

Solution code:
import math

s = list(input())
t = list(input())
s.reverse()
s=''.join(s)
t.reverse()
t=''.join(t)
n = s.index(t[0])
res = len(t)
num =0
while len(s)>=len(t):
    if len(s)<=len(t) and s[0] != t[0]:break
    n = s.index(t[0])
    for i in range(len(t)):
        if t[i]!=s[i+n]:
            num+=1
    res = min(res,num)
    s = s[n+len(t):]
print(res)

Submission status: Runtime Error

Solution code:
S=list(map(str,input()))
T=list(map(str,input()))
X=[]
Z=0
for I in range(len(S)-len(T)):
    Y=S[I:I+len(T)]
    Z=0
    for J in range(len(T)):
        if Y[J]==T[J]:
            Z=Z+1
    X.append(Z)
print(len(T)-max(X))

Submission status: Runtime Error

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

slen = len(s)
tlen = len(t)

i = tlen
n = 0
a = 0
tuu = [0] * tlen
ans = [0] * tlen
max_count = 0
while i <= slen:
    ps = s[ n : i + tlen -1 ]
    count = 0
    for j in range(tlen):
        if ps[j] == t[j]:
            count += 1
            tuu[j] = "True"
#             print("通った")
#     print(count)
    if max_count < count:
        max_count = count
#         print("通った")
        a = n
        ans = tuu
        
#     print(a)    
    n += 1
    i += 1
# print(a)
# print(ans)

for h in range(tlen):
    if ans[h] == "True":
        pass
    else:
        t[h] = s[a + h]

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:
date0=input()
date1=input()
list=[]
if len(date1)>len(date0)-len(date1):
    N=len(date0)-len(date1)
else:
    N=len(date1)
for i in range(N):
    if date1[i] in date0[i:]:
        j=0
        result=1
        for j in range(len(date1)-i-1):
            if date1[i:j+i+2] in date0[i:]:
                result += 1
            else:
                break
        list.append(result)
list=sorted(list)
print(len(date1)-list[-1])

Submission status: Runtime Error

Solution code:
def main():

	s = str(input())
	t = str(input())
	
	if len(s) < len(t):
		print(0)
	
	else:
		l = []
		for i in range(len(s)-len(t)):
			l.append(s[i:i+len(t)])
		
		ans = []
		for c in l:
			counter = 0
			for i in range(len(c)):
				if list(c)[i] == t[i]:
					counter += 1
			ans.append(counter)

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





	

if __name__ == '__main__':
	main()

Submission status: Runtime Error

Solution code:
def main():
	s = str(input())
	t = str(input())
	
	if len(s) > len(t):
		print(0)
	
	else:
		l = []
		for i in range(len(s)-len(t)):
			l.append(s[i:i+len(t)])
		
		ans = []
		for c in l:
			counter = 0
			for i in range(len(c)):
				if list(c)[i] == t[i]:
					counter += 1
			ans.append(counter)
			
		print(len(t)-max(ans))





	

if __name__ == '__main__':
	main()

Submission status: Runtime Error

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

L = len(s)
l = len(t)
print(L, l)

r = []
print("L-l=", L-l)
for i in range(L - l):
    x = 0
    print("i + l=", i + l)
    for k in range(i, i + l - 2):
        if s[k] == t[k]:
            x += 1
    print("x=", x)
    r.append(x)

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

Submission status: Runtime Error

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

min_count = 10000000

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

Submission status: Runtime Error

Solution code:
import itertools

def main():
  s = input()
  t = input()
  for i in range(len(t)):
    if t[0:i] in s:
#      print(t[0:i],s,i)
      ans1 = i
    if t[i:] in s:
#      print(t[i:],s,i)
      ans2 = len(t)-i      
  print(len(t)-max(ans1,ans2))    
  #print(ans1,ans2)   
  
if __name__ == '__main__':
  main()

Submission status: Runtime Error

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

min = length(T)

for index in range( length(S)-length(T)+1 ):
  temp = 0
  for index2 in range(T):
    if T[index2] == S[index+index2]:
      temp += 1
  if temp < min:
    min = temp

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:
#from functools import lru_cache
import sys
from itertools import product,combinations
from functools import reduce,lru_cache

def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def list_t(l): return vfunc(lambda *args:args)(*l)

def rvfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:rvfunc(f)(*x,**kwargs) if all(vfunc(lambda y:isinstance(y,list))(x)) else f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

s,t = list_t(reader())[0]
out = []
if len(t)==1: print(len(t) if all(vfunc(lambda a:t[0]!=s)(s)) else len(t)-1)
else:
    for i in range(len(s)-len(t)):
        txt = s[i:i+len(t)]
        out.append(sum(vfunc(lambda a,b:a==b)(t,txt)))

    print(len(t)-int(max(out)))

Submission status: Runtime Error

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
		else
			counter = 0
	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: Runtime Error

Solution code:
def main():

	s = str(input())
	t = str(input())
	l = []
	for i in range(len(s)-len(t)):
		l.append(s[i:i+len(t)])
	ans = []
	for c in l:
		counter = 0
		for i in range(len(c)):
			if list(c)[i] == t[i]:
				counter += 1
		ans.append(counter)
	print(len(t)-max(ans))





	

if __name__ == '__main__':
	main()

Submission status: Runtime Error

Solution code:
S, T = [input() for i in range(2)]

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

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()

for i in range(len(t)+1):
	if t[0:len(t)-i] in s or t[i:len(t)] in s:
		break

for j in range(int(len(t)/2)):
	if t[j:len(t)-j] in s:
		break

if i < j*2:
	print(i)
else:
	print(j*2)

Submission status: Runtime Error

Solution code:
S = input()
T = input()
K = []
for i in range(len(S) - len(T)):
    V = S[i:i + len(T)]
    C = 0
    for l in range(len(T)):
        if T[l] == V[l]:
            C += 1
    K.append(C)
print(len(T) - max(K))

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:
                    # print(j,i,t,p,j<=p and len(T)-j-1 <=len(S)-p-1,len(T)-i)
                    if j<=p and len(T)-j-1 <=len(S)-p-1:
                        return i

print(len(T)-x())

Submission status: Runtime Error

Solution code:
S = input()
T = input()
lis = []
count = 0 
saishou = 0

for i in range(len(T)):
  for j in range(i, len(S)-len(T)+i):
    c = 0
    while  i + c < len(T) and j + c < len(S) :
      if T[i+c] == S[j+c]:
        c = c + 1
        lis.append(c)
      else:
        break
        

saidai = max(lis)
saishou = len(T) - saidai

print(saishou)

Submission status: Runtime Error

Solution code:
S = input()
T = input()
C = []
for i in range(len(S) - len(T)):
  s = S[i:len(T)+i]
  c = 0
  for j in range(len(T)):
    if s[j] == T[j]:
      c += 1
  C.append(c) 
print(len(T)-max(C))

Submission status: Runtime Error

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

x = [0]
a = 0
for i in range(len(s)):
    if((s[i] == t[0]) and ((len(s)- i) >= (len(t)-1))):
        for k in range(1,len(t)):
            if(s[i+k] == t[k]):
                a += 1
    x.append(a+1)
    a = 0

y = max(x) 
print((len(t) - y))

Submission status: Runtime Error

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

Solution code:
S = input()
T = input()
l = len(T)
ans = l
print(ans)
for i in range(l):
  for j in range(l):
    if (i<=j):
      if T[i:j+1] in S:
        if f >= i and f + (l-j) <= len(S):
          ans = min(ans, l - (j+1-i))
print(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)):
        print(i,j)
        print(T[i:j+1])
        print(T[i:j+1] in S)
        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: Runtime Error

Solution code:
s=input()
t=input()
S=[]
for i in range(len(s)):
    if s[i] in t:
        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
print(min(S))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Solution code:
import numpy as np
max_change = 1000
s = input()
t = input()
list_t = np.array([ _ for _ in t])
for i in range(1,len(s) - len(t) + 1):
    s_sample = s[i-1:len(t)+i-1]
    list_ss = np.array([ _ for _ in list_ss])
    list_tf = list_t == list_ss
    n_change = len(list_t) - sum(list_tf)
    if n_change < max_change:
        max_change = n_change
    else:
        pass
print(max_change)

Submission status: Runtime Error

Solution code:
S = str(input())
T = str(input())
tempcount = 0
mincount = 0

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

for i in range(len(S) - len(T)+1):
    for j in range(len(T)+1):
        if S[i + j] != T[j]:
            tempcount += 1
    if i == 0:
        mincount = tempcount
    elif tempcount < mincount:
        mincount = tempcount
    tempcount = 0
    
print(mincount)

Submission status: Runtime Error

Solution code:
S,T = input().split()
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: Runtime Error

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

mS = []
d = len(S) - len(T)

for j in range(d):
    m = 0
    for i in range(len(T)):
        if S[i] == T[i] :
            m += 1

    mS.append(m)
    S = S[1:]
print(len(T) - max(mS))

Submission status: Runtime Error

Solution code:
import math

s = list(input())
t = list(input())
s.reverse()
s=''.join(s)
t.reverse()
t=''.join(t)
#print(s)
n = s.index(t[0])
#print(n)
res = len(t)
num =0
while len(s)!=0:
    if len(s)<=len(t) and s[0] != t[0]:break
    n = s.index(t[0])
    for i in range(len(t)):
        if t[i]!=s[i+n]:
            num+=1
    res = min(res,num)
    s = s[n+len(t):]
print(res)

Submission status: Runtime Error

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

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

print(len(t)-ans)

Submission status: Runtime Error

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

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

else:
    countbox=[]
    for n in range(len(S)-len(T)):
        count =0
        for i in range(len(T)):
            if T[i] != S[i+n+1]:
                count+=1
        countbox.append(count)
    print(min(countbox))

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
using P = pair<int, int>;

int main() {

    string S, T;
    cin >> S >> T;

    int ans = 10000;
    int cnt = 0;

    for (int i = 0; i < S.size() - T.size() + 1; ++i) {
        for (int j = i; j < T.size()+i; ++j) {
            if (S[j] != T[j-i]) cnt++;
        }

        ans =  min(ans, cnt);
        cnt = 0;
    }

    cout << ans << endl;


    return 0;
}

Submission status: Runtime Error

Solution code:
S = str(input())
T = str(input())
init = len(T)
tmp = init
for i in range(0,len(S)-1):
    if i > len(S)-len(T)-1:
        break
    for n in range(0, len(T)-1):
        if S[i]==T[n]:
            ans -=1
            if ans < tmp:
                tmp =ans
        else:
            ans = init


ans = tmp
print(ans)

Submission status: Runtime Error

Solution code:
#from functools import lru_cache
import sys
from itertools import product,combinations
from functools import reduce,lru_cache
import heapq

def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def list_t(l): return vfunc(lambda *args:args)(*l)

def rvfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:rvfunc(f)(*x,**kwargs) if all(vfunc(lambda y:isinstance(y,list))(x)) else f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

s,t = list_t(reader())[0]
out = []
for i in range(len(s)-len(t)):
    txt = s[i:i+len(t)]
#    print(t,txt)
    out.append(sum(vfunc(lambda a,b:a==b)(t,txt)))
#    print(out)

print(len(t)-int(max(out)))

Submission status: Runtime Error

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


countbox=[]
for n in range(len(S)-len(T)):
    count =0
    for i in range(len(T)):
        if T[i] != S[i+n+1]:
            count+=1
    countbox.append(count)
print(min(countbox))

Submission status: Runtime Error

Solution code:
#from functools import lru_cache
import sys
from itertools import product,combinations
from functools import reduce,lru_cache
import heapq

def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def list_t(l): return vfunc(lambda *args:args)(*l)

def rvfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:rvfunc(f)(*x,**kwargs) if all(vfunc(lambda y:isinstance(y,list))(x)) else f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

s,t = list_t(reader())[0]
out = []
for i in range(len(s)-len(t)):
    txt = s[i:i+len(t)]
#    print(t,txt)
    out.append(sum(vfunc(lambda a,b:a==b)(t,txt)))
#    print(out)

print(len(t)-max(out))

Submission status: Runtime Error

Solution code:
S = input()
T = input()
ev = [0] * (len(S) - len(T))
for i in range(len(S) - len(T)):
  commit = 0
  for j in range(len(T)):
    if S[i + j] == T[j]:
      commit += 1
  ev[i] = commit

ev.sort(reverse=True)
print(len(T) - ev[0])

Submission status: Runtime Error

Solution code:
S=list(map(str,input()))
T=list(map(str,input()))
x=[]
y=0

for i in range(len(S)-len(T)):
    Y=S[i:i+len(T)]
    y=0
    for j in range(len(T)):
        if Y[j]==T[j]:
            y=y+1
    x.append(y)
print(len(T)-max(x))

Submission status: Runtime Error

Solution code:
def findProductSum(A, n): 
      
    array_sum = 0
    for i in range(0, n, 1): 
        array_sum = array_sum + A[i] 

    array_sum_square = array_sum * array_sum 
  
    individual_square_sum = 0
    for i in range(0, n, 1): 
        individual_square_sum += A[i] * A[i] 
 
    return (array_sum_square - 
            individual_square_sum) / 2

N = int(input())
A = list(map(int, input().split()))
modulo = 1000000007
answer = findProductSum(A, N)
print(answer%modulo)

Submission status: Runtime Error

Solution code:
import sys
s = input()
t = input()
ans = 0
if(t in s):
    print(0)
    sys.exit(1)
for i in range(len(t)):
    for j in range(i,len(t)):
        me = t[i:j]
        if(me in s[i:]):
            ans = max(len(me),ans)
print(len(t)-ans)

Submission status: Runtime Error

Solution code:
import pandas as pd

def diffab(x):
    if x.a == x.b:
        return 1
    else:
        return 0

max_change = 1000

s = input()
t = input()
list_t = pd.Series([ _ for _ in t],name="a")

for i in range(1,len(s) - len(t) + 1):
    s_sample = s[i-1:len(t)+i-1]
    list_ss = pd.Series([ _ for _ in s_sample],name="b")
    df = pd.concat([list_t,list_ss],axis=1)
    df['flg'] = df.apply(lambda x:diffab(x),axis=1)
    n_change = len(list_t) - sum(df.flg)
    if n_change < max_change:
        max_change = n_change
    else:
        pass
print(max_change)

Submission status: Runtime Error

Solution code:
S = input()
T = input()
ev = [0] * (len(S) - len(T))
for i in range(len(S) - len(T)):
  commit = 0
  for j in range(len(T)):
    if S[i + j] == T[j]:
      commit += 1
  ev[i] = commit

greatest = max(ev)
print(len(T) - greatest)

Submission status: Runtime Error

Solution code:
S = str(input())
T = str(input())
init = len(T)
tmp = init
for i in range(0,len(S)-1):
    for n in range(0, len(T)-1):
        if S[i]==T[n]:
            ans -=1
            if ans < tmp:
                tmp =ans
        else:
            ans = init


ans = tmp
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
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
    i = i + int(tmp[i])
    if i >= len(T)-1:
        flg=False

print(int(np.max(tmp)))

Submission status: Runtime Error

Solution code:
s=input()
t=input()
S=[]
for i in range(len(s)):
    if s[i] in t:
        p=len(t)-1
        q=t.index(s[i])
        if q>i or i-q+p+1>len(s)-1:
            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
print(min(S))

Submission status: Runtime Error

Solution code:
S = input()
T = input()
cnt_list = []

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

print(min(cnt_list))

Submission status: Runtime Error

Solution code:
S=input()
T=input()
count=0
if S.find(T)!=-1:
    print(0)
else:
    a=0
    for i in range(len(T)-1):
        if S.find(T[0:len(T)-i-1])!=-1:
            count=count+1
            print(count)
            a=1
            break
        else:
            count=count+1

if a==0:
    print(count)

Submission status: Runtime Error

Solution code:
S=list(map(str,input()))
T=list(map(str,input()))
x=[]
y=0

for i in range(len(S)-len(T)):
    Y=S[i:i+len(T)]
    y=0
    for j in range(len(T)):
        if Y[j]==T[j]:
            y=y+1
    x.append(y)
print(len(T)-max(x))

Submission status: Runtime Error

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

for i in range(len(T)):
  for j in range(i+1):
    if T[j:len(T)+j-i] in S[j:]:
      L.append(len(T[j:len(T)+j-i]))

print(len(T)-max(L))

Submission status: Runtime Error

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

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

ans = 1000
for i in range(len_s - len_t + 1):
    cnt = 0
    l = []
    for j in range(len_t):
        if s[i + j] == t[j]:
            cnt += 1
        else:
            l.append(cnt)
            cnt = 0

    ans = min(ans, len_t - max(l))

print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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