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:
#include <bits/stdc++.h>
using namespace std;

#define max(a, b) ((a > b) ? a : b)
#define min(a, b) ((a < b) ? a : b)

#define forn(n) for(int i = 0; i < n; i++)
#define fork(k, n) for(int i = k; i < n; i++)

#define pb(n) push_back(n);

typedef long long ll;
typedef double dbl;

const int MX = 1e6;
const int MOD = 1e9 + 7;
const string ALPHA = "abcdefghijklmnopqrstuvwxyz";
const double PI = 3.1415926535;


int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
	//Code here bby
  string s, t;
  cin>>s>>t;
  int res = 1e9;
  for(int idx = 0; idx < s.size() - t.size() + 1; idx++){
    int dif = 0;
    for(int chk = 0; chk < t.size(); chk++){
      if(s[chk + idx] != t[chk]){
        dif++;
      }
    }
    res = min(res, dif);
  }
  cout<<res<<endl;
}

Submission status: Runtime Error

Solution code:
N=int(input())
S=list(input().split())
A=[int(n) for n in S]
ans=int(0)
for i in A:
    for j in A:
        ans += i*j
print(ans)

Submission status: Runtime Error

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

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

  for j in range(len(t)):
    if i < j:
      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: 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:
        ans = 0
  ans = 0
m =  max(list1)
print(l-m)

Submission status: Runtime Error

Solution code:
sList = list(input())
tList = list(input())
numList = []

for t in enumerate(tList):
  num = 0
  for s in enumerate(sList):
    i = t
    j = s
    while tList[i] == sList[j]:
      num += 1
      i += 1
      j += 1
  numList.Append(num)
print(len(tList) - max(numList))

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
  for j in range(i+1, n):
    b.append(a[i] % (10 ** 9 + 7) * (a[j] % (10 ** 9 + 7))
print(sum(b) % (10 ** 9 + 7))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
s=input()
t=input()
index=0
count=0
for i in range (len(s)):
    if s[i]==t[0]:
       index=i+1
       break
if index == 0:
    for j in range(len(t)):
        if t[j]!=s[j]:
            count+=1
    
else:
    
    for j in range (1,len(t)):
        if t[j]!= s[index]:
            count+=1
        index+=1
print(count)

Submission status: Runtime Error

Solution code:
s = input()
t = input()
count = 0
res = ''
ans = ''

for x in t:
  if x not in s:
    continue
  elif t.index(x) > s.index(x):
    continue
  else:
    i = s.index(x)
    ans = x
  
res = s[i-t.index(ans):i-t.index(ans)+len(t)]

if res:
  if len(res) < len(t):
    print(len(t))
  else:
    for i in range(len(res)):
      if res[i] != t[i]:
        count += 1
    print(count)
else:
  print(len(t))

Submission status: Runtime Error

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


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


print(a())

Submission status: Runtime Error

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

countbox=[]
for n in range(len(S)-2-len(T)+1):
    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:
S=str(input())
T=str(input())
ls = []
cnt = 0
for i in range(len(S)-len(T)):
    cnt = 0
    for j in range(len(T)):
        if T[j] != S[j+i]:
            cnt += 1
    ls.append(cnt)
print(min(ls))

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))
ans = 0
m0 = 10**9+7
for i in range(0,N-1):
    for j in range(i+1,N):
        ans = (ans + A[i]*A[j]) % m0
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Solution code:
S = input()
T = input()
match = 0
match_list = list()
if T in S:
  print(0)
  exit()
elif set(list(S)).intersection(set(list(T))) == set():
  print(len(T))
  exit()
else:
  for i in range(len(T), len(S)):
    match = 0
    list_S = list(S[i-len(T):i])
    list_T = list(T)
    for j in range(len(T)):
      if list_S[j] == list_T[j]:
        match = match + 1
    if match == len(T)-1:
      print(1)
      exit()
    else:
    	match_list.append(match)
print(len(T)-max(match_list))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
def check(s,t,n):
    if s.find(t) != -1:
        print(n)
    else:
        n += 1
        t = t[:-1]
        check(s,t,n)
s = input()
t = input()
n = 0
check(s,t,n)

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

Submission status: Runtime Error

Solution code:
s = input()
t = input()
s_list = list(s)
t_list = list(t)
compare = []
score = []

if s == t:
    print(0)
else:
    for i in range(len(s) - len(t) + 1):
        compare.append(s[i : i + len(t)])
    
    for v in compare:
        count = 0
        for v1, v2 in zip(list(v), t_list):
            #print(v1, v2)
            if v1 == v2:
                count += 1
        score.append(count)

print(len(t) - max(score))

Submission status: Runtime Error

Solution code:
ans = []

for i in range(M-N+1):

    num = 0

    substring = input_list[0][i:i+N]

    for j in range(len(substring)):

        if substring[j] != input_list[1][j]:

            num += 1

    ans.append(num)

print(min(ans))

Submission status: Runtime Error

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

N = len(T)
count = 0
count_list = []

index_list = []

if len(S)-len(T) != 0:
    for i in range(len(S)-N+1):
        index_list.append(S[0+i:N+i])

    for i in range(len(index_list)):
        count = 0
        for j in range(N):
            if index_list[i][j] == T[j]:
                count +=1
                count_list.append(count)
                
    print(N - max(count_list))
else:
    for i in range(N):
        if S[i] == T[i]:
            count += 1
    print(N - count)

Submission status: Runtime Error

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

countbox=[]
for n in range(len(S)-2-len(T)+1):
    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:
 S = input()
T = input()

Min = 100000

for i in range(len(S) - len(T) + 1):
    count = 0
    for n in range(len(T)):
        if S[i + n] != T[n]:
            count += 1
    if count < Min:
        Min = count

print(count)

Submission status: Runtime Error

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

for i in np.flip(np.arange(len(t))):
    if t[:i] in s:
        print(len(t)-i)
        break
    else:
        print(len(t))

Submission status: Runtime Error

Solution code:
s, t = input().split("\n")

s_l = len(s)
t_l = len(t)

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

diff = t_l - max_count
print(diff)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

#bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す
#つまりlist[i] < x となる i の個数
#bisect.bisect_right(list, key)はlistのなかでkey以下の数字がいくつあるかを返す
#つまりlist[i] <= x となる i の個数
#これを応用することで
#len(list) - bisect.bisect_left(list,key)はlistのなかでkey以上の数字がいくつあるかを返す
#len(list) - bisect.bisect_right(list,key)はlistのなかでkeyより大きい数字がいくつあるかを返す
#これらを使うときはあらかじめlistをソートしておくこと！
s= input()
t = input()
ans = []

for j in range(len(s)-len(t)):
    cnt = 0
    moji = s[j:j+len(t)]
    for k in range(len(t)):
        if moji[k] != t[k]:
            cnt += 1
    ans.append(cnt)
print(min(ans))

Submission status: Runtime Error

Solution code:
s = input()
t = input()
if t in s:
  print(0)
else:
  ans = 1000
  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
        	l = j
            cnt1 = 0
            while k < len(t):
            	if t[k] != s[l]:
                  cnt1 += 1
                k += 1
                l += 1
            k = i
        	l = j
            cnt2 = 0
            while k >= 0:
            	if t[k] != s[l]:
                  cnt2 += 1
                k -= 1
                l -= 1
            ans = min(ans, cnt1 + cnt2)    
        else:
          break
print(ans)

Submission status: Runtime Error

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(len(t)-i):
                if t[i+k] == s[j+k]:
                    length += 1
                else:
                    break
            if length > max_length:
                max_length = length
print(len(t)-max_length)

Submission status: Runtime Error

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

a = ans.index(max(ans))
b = s[a:a+len(t)]
count = 0
for k in range(len(t)):
    if t[k] != b[k]:
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    S_ = S()
    T = S()
    a = len(S_)
    b = len(T)
    cnt_list = []

    if a == b:
        cnt = 0
        for i in range(b):
            if S_[i] == T[i]:
                cnt += 1

    else:
        for i in range(a - b + 1):
            cnt = 0
            S_1 = S_[i:i + b]
            for i in range(b):
                if S_1[i] == T[i]:
                    cnt += 1
            cnt_list.append(cnt)

    ans = b - max(cnt_list)
    print(ans)



if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
s = input()
t = input()
ratio = []
cnt = 0

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

Submission status: Runtime Error

Solution code:
S = input()
T = input()
D = []
for i in range(len(S) - len(T)):
    SS = S[i:i+len(T)]
    dif = 0
    for j in range(len(T)):
        if T[j] != SS[j]:
            dif += 1
    D += [dif]
            
print(min(D))

Submission status: Runtime Error

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

L = 0
judge = False

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

print(len(T)-L)

Submission status: Runtime Error

Solution code:
S=input()
T=input()
a=len(S)
b=len(T)
m=a-b
A=[]
for i in range(m):
    cnt=b
    for j in range(b):
        if S[i+j]==T[j]:
            cnt-=1
    A.append(cnt)
print(min(A))

Submission status: Runtime Error

Solution code:
#inp = list(map(int, input().split()))
S = input()
T = input()

tmp = []*len(T)

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

Submission status: Runtime Error

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

Min = 100000

for i in range(len(S)):
    if i + len(T) > len(S) - 1:
        break
    count = 0
    for n in range(len(T)):
        if S[i + n] != T[n]:
            count += 1
    if count < Min:
        Min = count

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
s = input()
t = input()
j=0
maxa = 0
maxb = 0
if(len(t)==0):
    print("0")
    sys.exit(1)
for i in range(len(s)):
    if(s[i]==t[j]):
        j+=1
        if(j==len(t)):
            maxa = max(maxa,j)
            break
    else:
        maxa = max(maxa,j)
        j=0
j=len(t)-1
for i in range(len(s)-1,-1,-1):
    if(s[i]==t[j]):
        j-=1
        if(j==0):
            maxb = max(maxb,len(t)-1-j)
            break
    else:
        maxb = max(maxb,len(t)-1-j)
        j=len(t)-1
print(min(len(t)-maxa,len(t)-maxb))

Submission status: Runtime Error

Solution code:
S = list(input())
T = list(input())
O = list()
a = 0
for i in range (len(S) - len(T)):
    b = 0
    m = 0
    for i in range (len(T)):
        if S[b + a] != T[b]:
            m = m + 1
        b = b + 1
    O.append(m)
    a = a + 1
O.sort()
print(O[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()
T = input()
D = []
for i in range(len(S) - len(T)):
    SS = S[i:i+len(T)]
    dif = 0
    for j in range(len(T)):
        if T[j] != SS[j]:
            dif += 1
    D += [dif]
            
print(min(D))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()
T = input()
match = 0
match_list = list()
if T in S:
  print(0)
else:
  for i in range(len(T), len(S)):
    match = 0
    list_S = list(S[i-len(T):i])
    list_T = list(T)
    for j in range(len(T)):
      if list_S[j] == list_T[j]:
        match = match + 1
    match_list.append(match)

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

Submission status: Runtime Error

Solution code:
s=input()
t=input()
cnt=0
a=[]
for i in range(len(s)):
    
    for l in range(len(t)):
        if t[l]==s[i]:

            cnt+=1
        else:
            a.append(cnt)
            cnt=0
#print(*a)
print(len(t)-max(a))

Submission status: Runtime Error

Solution code:
S = input()
T = input()
s1 = list(S)
t1 = list(T)
a = len(s1); b = len(t1)
z = []
for i in range(a-b):
    x = []
    y = 0
    for j in range(b):
        x.append(s1[i+j])
    for k in range(b):
        if t1[k]==x[k]:
            y += 1
    z.append(y)
print(b-max(z))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    S_ = S()
    T = S()
    a = len(S_)
    b = len(T)
    cnt_list = []
    
    if a == b:
        cnt = 0
        for i in range(b):
            if S_[i] == T[i]:
                cnt += 1

    else:    
        for i in range(a - b):
            cnt = 0
            S_1 = S_[i:i + b + 1]
            for i in range(b):
                if S_1[i] == T[i]:
                    cnt += 1
            cnt_list.append(cnt)

    ans = b - max(cnt_list)
    print(ans)



if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import Levenshtein
s=input()
t=input()
print(Levenshtein.distance(s,t))

Submission status: Runtime Error

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

N = len(T)
count = 0
count_list = []

index_list = []

if len(S)-len(T) != 0:
    for i in range(len(S)-N):
        index_list.append(S[0+i:N+i])

    for i in range(len(index_list)):
        count = 0
        for j in range(N):
            if index_list[i][j] == T[j]:
                count +=1
                count_list.append(count)
                
    print(N - max(count_list))
else:
    for i in range(N):
        if S[i] == T[i]:
            count += 1
    print(N - count)

Submission status: Runtime Error

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

ans = len(t)
long = ans

for i in range(len(t)):
    tc = t[i]
    for j in range(0+i,len(s)):
        if tc == s[j]:
            count = 1
            for k in range(1,len(t)-i):
                if t[i+k] == s[j+k]:
                    count += 1
                else:
                    if ans > long - count:
                        ans = long - count
                    break

print(ans)

Submission status: Runtime Error

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

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

print(len(t) - max_len)

Submission status: Runtime Error

Solution code:
s=input()
t=input()
cnt=0
a=[]
for i in range(len(t)):
    
    for l in range(len(s)):
        if t[i]==s[l]:
            cnt+=1
        else:
            a.append(cnt)
            cnt=0
#print(*a)
print(len(t)-max(a))

Submission status: Runtime Error

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

print(ans)

Submission status: Runtime Error

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

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

print(min(ans))

Submission status: Runtime Error

Solution code:
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    S_ = S()
    T = S()
    a = len(S_)
    b = len(T)
    cnt_list = []
    for i in range(a - b):
        cnt = 0
        S_1 = S_[i:i + b + 1]
        for i in range(b):
            if S_1[i] == T[i]:
                cnt += 1
        cnt_list.append(cnt)

    ans = b - max(cnt_list)
    print(ans)



if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
def resolve():
    s = input()
    t = input()
    ls = len(s)
    lt = len(t)
    c = []
    for i in range(ls - lt):
        count = 0
        for j in range(lt):
            if s[i+j] == t[j]:
                count += 1
        c.append(count)
    print(lt - max(c))
resolve()

Submission status: Runtime Error

Solution code:
S = input()
T = input()
minimum = 0
for i in range(len(S)):
    m = 0
    for j in range(len(T)):
        if i + j == len(S):
            break
        else:
            if S[i+j] != T[j]:
                m += 1
    if m == 0:
        print(m)
    else:
        if minimum == 0:
            minimum = m
        elif:
            minimum >= m:
                minimum = m

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import numpy as np

S=input()
T=input()

max_score = 0
for i in range(len(list(S))-len(list(T))):
    tmp_T = np.array(list(T))
    tmp_S = np.array(list(S))[i:i+len(tmp_T)]
    score = np.zeros(len(tmp_T))
    score[tmp_T==tmp_S]=1
    score = np.sum(score)
    if max_score < score:
        max_score=score
print(int(len(tmp_T)-max_score))

Submission status: Runtime Error

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

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

print(len(T) - ans)

Submission status: Runtime Error

Solution code:
S = input()
T = input()
maxs = 0
for x in range(len(S)-len(T)+1):
    for y in range(len(T)):
        if T[y] == S[x+y]:
            count += 1
        else:
            count = 0
        maxs = max(count,maxs) 

print(len(T)-maxs)

Submission status: Runtime Error

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

if T in S:
    print("0")
else:
    slen = len(S)
    tlen = len(T)
    ansCnt = tlen

    for i in range(slen-tlen):
        cnt = 0
        for j in range(tlen):
            if T[j]!=S[i+j]:
                cnt += 1
        
        if ansCnt>cnt:
            ansCnt = cnt

print(ansCnt)

Submission status: Runtime Error

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

c = [0] * (len(s) - len(t))

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

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

Submission status: Runtime Error

Solution code:
import sys
list_a = []
S = input()
T = input()
if T in S:
    print(0)
    sys.exit()
for i in range(len(S) - len(T)):
    cnt = 0
    for j in range(len(T)):
        if T[j] != S[i + j]:
            cnt += 1
    list_a.append(cnt)
print(min(list_a))

Submission status: Runtime Error

Solution code:
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    S = input()
    T = input()

    numdic = [0]*(len(T)+1)
    for i in range(len(S)+1-len(T)):
        small = S[i:i+len(T)]
        same = 0
        for s in range(len(T)):
            if small[s] == T[s]:
                same += 1
        numdic[i] = same

    ans = len(T) - max(numdic)
    print(ans)




if __name__ == '__main__':
    solve()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

print(len(T) - ans)

Submission status: Runtime Error

Solution code:
s=input()
t=input()
a=0
b=[]
c=[]
for i in range(len(s)-len(t)):
    b.append(s[i:len(t)+i])


for i in range(len(b)):
    for j in range(len(b[i])):
        if b[i][j]!=t[j]:
            a+=1
    c.append(a)
    a=0
        
print(min(c))

Submission status: Runtime Error

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

s = list(s)
s.append("0")
t = list(t)
roop = len(s)-len(t)
cc = []
for i in range(roop):
  c = 0
  tmp = []
  tmp = s[i:len(t)+1+i]
  for i in range(len(t)):
    if tmp[i] == t[i]:
      c += 1
  cc.append(c)

ma = max(cc)
a = cc.index(ma)
tmp = s[a:1+len(t)]
ans = 0
for i in range(len(t)):
  if tmp[i] != t[i]:
    ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
s = input()
t = input()
j=0
maxa = 0
maxb = 0
for i in range(len(s)):
    if(s[i]==t[j]):
        j+=1
    else:
        maxa = max(maxa,j)
        j=0
j=len(t)-1
for i in range(len(s)-1,-1,-1):
    if(s[i]==t[j]):
        j-=1
    else:
        maxb = max(maxb,len(t)-1-j)
        j=len(t)-1
print(min(len(t)-maxa,len(t)-maxb))

Submission status: Runtime Error

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


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

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

print(tmp)

Submission status: Runtime Error

Solution code:
s = input()
t = input()
lent = len(t)
ans = []
for i in range(len(s) - lent):
    ss = s[i:i+lent]
    ans1 = 0
    for s1, t1 in zip(ss, t):
        ans1 += (s1==t1)
    ans.append(ans1)
print(lent-max(ans))

Submission status: Runtime Error

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

print(ans)

Submission status: Runtime Error

Solution code:
s = list(str(input()))
t = list(str(input()))
l = []
count = 0
for i in range(len(s)-len(t)):
    for j in range(len(t)):
        if s[i+j] != t[j]:
            count += 1

    l.append(count)
    count = 0
print(min(l))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
S = input()
T = input()
score_list = []
diff = len(S) - len(T)
len_T = len(T)
for i in range(0, diff):
  s = S[i:i+len_T]
  score = sum([1 if s[i]==T[i] else 0 for i in range(len(s))])
  score_list.append(score)

print(len_T - max(score_list))

Submission status: Runtime Error

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

i = 0
j = len(t)
m = j

while j < len(s):
  count = 0
  for k in range(i, j):
    if s[k] == t[k]
      count += 1
      m = min(m, len(t) - count)
  j += 1
  i += 1

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

l = len(T)
for i in range (l):
    if T[:l-i] in S:
        ans = i
        break
    if T[i:] in S:
        ans = i
        break

print(ans)

Submission status: Runtime Error

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

counters = []
for i in range(len(s) - len(t)):
  part_of_s = s[i: i + len(t)]
  counter = 0
  for sss, ttt in zip(part_of_s, t):
    if sss != ttt:
      counter += 1
  counters.append(counter)
print(min(counters))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

            tmp += 1
    result.append(tmp)

print(len(t)-max(result))

Submission status: Runtime Error

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

for ti in range(len(t)):
    for si in range(len(s)):
        if t[ti] == s[si]:
            cnt += 1
            ans = max(0,cnt)
        else:
            cnt = 0
print(len(t) - ans)