TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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`.

Submission attempts (in order):
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)
        

S = input()
T = input()
ls = len(S)
lt = len(T)
ans = lt
for i in range(0,ls-lt+1):
  m = 0
  for j in range(lt):
    if S[i:i+lt][j]!=T[j]:
      m += 1
  ans = min(ans,m)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
s=input()
t=input()

for i in range(len(s)-len(t)):
    ans=10**9+7
    miss=0
    tmp=s[i:i+len(t)]
    for j in range(len(t)):
        if tmp[j]!=t[j]:
            miss+=1
    ans=min(ans, miss)

print(ans)


s=input()
t=input()

ans=10**9+7
for i in range(len(s)-len(t)+1):
    miss=0
    tmp=s[i:i+len(t)]
    for j in range(len(t)):
        if tmp[j]!=t[j]:
            miss+=1
    ans=min(ans, miss)

print(ans)



Verdicts: Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
s = input()
t = input()
ss = len(s)
tt = len(t)
min = tt

for i in range(ss - tt + 1):
  count = 0
  for j in range(tt):
    if s[j] != t[j]:
      count += 1
  if min > count:
    min = count

print(min) 


s = input()
t = input()
ss = len(s)
tt = len(t)
min = tt


for i in range(ss - tt + 1):
  count = 0
  for j in range(tt):
    if s[i+j] != t[j]:
      count += 1
  if min > count:
    min = count

print(min) 


Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
S = input()
T = input()

size = len(T)
n = len(S)
ans = size

for i in range(n-size+1):
    t = S[i:i+size]
    print(t)
    v = sum([k!=j for k, j in zip(T, t)])
    ans = min(v, ans)

print(ans)


S = input()
T = input()

size = len(T)
n = len(S)
ans = size

for i in range(n-size+1):
    t = S[i:i+size]
    v = sum([k!=j for k, j in zip(T, t)])
    ans = min(v, ans)

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
S = input()
T = input()

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

for i in range(len_S-len_T):
    diff = 0
    for j in range(len_T):
        if T[j] != S[i+j]:
            diff += 1
    output = min(output, diff)

print('output',output)
                

S = input()
T = input()

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

for i in range(len_S-len_T+1):
    diff = 0
    for j in range(len_T):
        if T[j] != S[i+j]:
            diff += 1
    output = min(output, diff)

print(output)

Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
s = input()
t = input()
ls = len(s)
lt = len(t)

ans = 0
for i in range(ls-lt+1):
  same = 0
  for j in range(lt):
    ind = i+lt
    if s[ind]==t[j]:
      same += 1
  ans = min(ans,min)
print(ans)

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

ans = 0
for i in range(ls-lt+1):
  same = 0
  for j in range(lt):
    ind = i+j
    if s[ind]==t[j]:
      same += 1
  ans = max(ans,same)
print(lt-ans)


Verdicts: Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
S = input().strip()	 # novel
T = input().strip()  # substring

x = len(T)
ans = len(S)
for i in range(len(S) - x):
  U = S[i:i+x]
  cost = sum(1 if U[k] != T[k] for k in range(x))
  ans = min(ans, cost)
print(ans)

S = input().strip()	 # novel
T = input().strip()  # substring

x = len(T)
ans = len(S)
for i in range(len(S) - x + 1):
  U = S[i:i+x]
  cost = sum(1 if U[k] != T[k] else 0 for k in range(x))
  ans = min(ans, cost)
print(ans)


Verdicts: Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
s=input()
t=input()

count = []

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

print(len(t)-max(count))


s=input()
t=input()

count = []

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

# print(count)
print(len(t)-max(count))


Verdicts: Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
import numpy as np
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)):
        print(t[i], ss[i])
        if t[i]==ss[i]:
            n += 1
        if max_n < n:
            max_n = n
    n = 0
print(len(t)-max_n)

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

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)

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)

import numpy as np
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
        if max_n < n:
            max_n = n
    n = 0
print(len(t)-max_n)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
S, T = [input() for _ in range(2)]
answer = 1001

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

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

answer = float("inf")

for i in range(len(S) - len(T) + 1):
	k = 0
	S_subset = S[i:i + len(T)]
	for t, s in zip(T, S_subset):
		if t != s:
			k += 1
	answer = min(answer, k)
print(answer)

Verdicts: Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
s = input()
t = input()

res = float("inf")
for i in range(len(t)):
    if t[i:] in s:
        res = i
        print("i:", i)
        break
for j in range(1, len(t) - 1):
    if t[:(-j)] in s:
        res = min(j, res)
        print("j:", j)
        break
print(res)


s = input()
t = input()

ls = len(s)
lt = len(t)
res = float("inf")
cnt = 0
for i in range(ls - lt+1):
    cnt= 0
    for j in range(lt):
        if s[i + j] != t[j]:
            cnt += 1
    res = min(res,  cnt)
print(res)   

Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
s = input()
t = input()

# ans = []

#     # print(t[i:])
#     # print(s[i:])
#     if t[i:] in s[i:]:
#         break
#     for j in range(1,len(t[i:])):
#         # print(t[i:][:-j])
#         # print(s[i:][:-j])
#         if t[i:][:-j] in s[i:][:-j]:
#             ans.append(i+j)
#             break
# if t in s:
#     print(0)
# elif len(ans) == 0:
#     print(len(t))
# else:
#     print(min(ans))
ans = len(t)
for i in range(len(s)-len(t)):
    dif = 0
    for j in range(len(t)):
        if t[j] != s[i:i+len(t)][j]:
            diff += 1
    ans = min(dif,ans)

print(ans)     

s = input()
t = input()

# ans = []

#     # print(t[i:])
#     # print(s[i:])
#     if t[i:] in s[i:]:
#         break
#     for j in range(1,len(t[i:])):
#         # print(t[i:][:-j])
#         # print(s[i:][:-j])
#         if t[i:][:-j] in s[i:][:-j]:
#             ans.append(i+j)
#             break
# if t in s:
#     print(0)
# elif len(ans) == 0:
#     print(len(t))
# else:
#     print(min(ans))
ans = len(t)
for i in range(len(s)-len(t)+1):
    dif = 0
    for j in range(len(t)):
        if t[j] != s[i:i+len(t)][j]:
            dif += 1
    ans = min(dif,ans)

print(ans)     

Verdicts: Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
s = input()
t = input()
ans = 0
for i in range(len(s)-len(t)+1):
    m = 0
    for j, k in zip(s[i:],t):
        if j==k:
            m += 1
    if m > ans:
        ans = m
print(ans)

#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;
}

s = input()
t = input()
ans = 0
for i in range(len(s)-len(t)+1):
    m = 0
    for j, k in zip(s[i:],t):
        if j==k:
            m += 1
    if m > ans:
        ans = m
print(len(t) - ans)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
s = input() #efabdd
t = input() #abcd
sl = len(s) #6
tl = input(t) #4
ans = tl #4
for i in range(sl-tl+1): #6-4+1 => 0, 1, 2
    c = 0
    for j in range(min(tl, sl): #min(4, 6) => 4
        if (s[i+j] != t[j]: #s[0] != t[0]..t[3]
            c += 1
    ans = min(c, ans) #min(0..4, 4)
print(ans)


s = input() #efabdd
t = input() #abcd
sl = len(s) #6
tl = len(t) #4
ans = tl #4
for i in range(sl-tl+1): #6-4+1 => 0, 1, 2
    c = 0
    for j in range(min(tl, sl)): #min(4, 6) => 4
        if (s[i+j] != t[j]): #s[0] != t[0]..t[3]
            c += 1
    ans = min(c, ans) #min(0..4, 4)
print(ans)


Verdicts: Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):

def match1(str1, str2):
    match_count = 0
    for i in range(len(str1)):
        if str1[i] == str2[i]:
            match_count += 1

    return match_count

S = input()
T = input()

max_match = 0
for i in range(0, len(S) +1 -len(T)):
    subS = S[i:i+len(T)]
    max_match = max(max_match, match1(T, subS))
    print("{} {}".format(subS, T))
    if max_match == 0:
        for j in range(len(T)):
            if T[j] == subS[j]:
                max_match = 1

print(len(T)-max_match)


def match1(str1, str2):
    match_count = 0
    for i in range(len(str1)):
        if str1[i] == str2[i]:
            match_count += 1

    return match_count

S = input()
T = input()

max_match = 0
for i in range(0, len(S) +1 -len(T)):
    subS = S[i:i+len(T)]
    max_match = max(max_match, match1(T, subS))
    if max_match == 0:
        for j in range(len(T)):
            if T[j] == subS[j]:
                max_match = 1

print(len(T)-max_match)

Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
S = input()
T = input()

cnt = 0

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


S = input()
T = input()

cnt = 0

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


Verdicts: Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
# coding: utf-8
# Your code here!
S = input()
T = input()

print(len(S))

a = 0
ans = len(T)

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


# coding: utf-8
# Your code here!
S = input()
T = input()

a = 0
ans = len(T)

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

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
S = input()
T = input()

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

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

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

S = input()
T = input()

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

S = input()
T = input()
cnt_list = []

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
s, t = [input() for i in range(2)]
ans = float("inf")
for i in range(len(s) - len(t)+1):
        cnt = 0
        for j in range(len(t)):
                if s[i + j] != t[j]:
                        cnt += 1
        print(s[i:i+len(t)], cnt)
        if ans  > cnt:
                ans = cnt
print(ans)       

s, t = [input() for i in range(2)]
ans = float("inf")
for i in range(len(s) - len(t)+1):
        cnt = 0
        for j in range(len(t)):
                if s[i + j] != t[j]:
                        cnt += 1
        if ans  > cnt:
                ans = cnt
print(ans)       

Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
S = input()
T = input()

s = len(S)
t = len(T)

ans = 10**9

for i in range(s - t + 1):
    tmp = 0
    for j in range(t):
        if S[i + j] != T[j]:
            tmp += 1

        print(S[i + j], T[j])

    ans = min(ans, tmp)

print(ans)

S = input()
T = input()

s = len(S)
t = len(T)

ans = 10**9

for i in range(s - t + 1):
    tmp = 0
    for j in range(t):
        if S[i + j] != T[j]:
            tmp += 1

    ans = min(ans, tmp)

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
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)

s = input()
t = input()
minCount = len(t)
i = 0
while i < len(s):
    countDiff = 0
    j = 0
    while j < len(t) and i+j < len(s):
        if t[j] != s[i+j]:
            countDiff += 1
        j += 1
        minCount = min(countDiff, minCount)
    i += 1
print(minCount)


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


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


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
S = input()
T = input()

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

print(ans)


S = input()
T = input()

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

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
S=input()
T=input()
length=len(T)
for i in range(0,len(S)-len(T)+1):
	diff=0
	for i in range(0,len(T)):
		if T[i]!=S[s+i]:
			diff+=1
	result=min(ans,diff)

print(result)


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

S=input()
T=input()
length=len(T)
for s in range(0,len(S)-len(T)+1):
	diff=0
	for i in range(0,len(T)):
		if T[i]!=S[s+i]:
			diff+=1
	result=min(ans,diff)

print(result)


S=input()
T=input()
result=len(T)
for s in range(0,len(S)-len(T)+1):
	diff=0
	for i in range(0,len(T)):
		if T[i]!=S[s+i]:
			diff+=1
	result=min(ans,diff)

print(result)


S=input()
T=input()
result=len(T)
for s in range(0,len(S)-len(T)+1):
	diff=0
	for i in range(0,len(T)):
		if T[i]!=S[s+i]:
			diff+=1
	result=min(result,diff)

print(result)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
S = str(input())
T = str(input())
lens = len(S)
lent = len(T)
ans = []

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

S = str(input())
T = str(input())
lens = len(S)
lent = len(T)
ans = []

for i in range(lens-lent + 1):
      count = 0
      U = S[i: i+lent]
      for j in range(lent):
            if U[j] != T[j]:
                count += 1
      ans.append(count)
print(min(ans))

Verdicts: Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
S = input()
T = input()
n = len(T)

def c(s, t):
  print(s)
  r = 0
  for i in range(n):
    if s[i] == t[i]:
      r += 1
  return n - r

ans = n
for i in range( len(S) - n + 1):
  temp = c(S[i:i+n],T)
  ans = min( ans, temp)

print(ans)

S = input()
T = input()
n = len(T)

def c(s, t):
  #print(s)
  r = 0
  for i in range(n):
    if s[i] == t[i]:
      r += 1
  return n - r

ans = n
for i in range( len(S) - n + 1):
  temp = c(S[i:i+n],T)
  ans = min( ans, temp)

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
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)

S = input()
T = input()

min = len(T)

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

print(min)

Verdicts: Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
s = input()
t = input()
ans = 10**8
for i in range(len(s)):
    cnt = 0
    for j in range(len(t)):
        if s[i+j] != t[j]: cnt += 1
    ans = min(ans, cnt)

print(ans)


s = input()
t = input()
ans = 10**8
for i in range(len(s)-len(t)+1):
    cnt = 0
    for j in range(len(t)):
        if s[i+j] != t[j]: cnt += 1
    ans = min(ans, cnt)

print(ans)


Verdicts: Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
def Qb():
    s = input()
    t = input()

    ans = len(t)
    for v in range(len(s) - len(t) + 1):
        a = [t[i] == x for i, x in enumerate(s[v:v + len(t) - v])]
        if a.count(False) < ans:
            ans = a.count(False)
    print(ans)

if __name__ == '__main__':
    Qb()


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

    ans = len(t)
    for v in range(len(s) - len(t) + 1):
        print(f'{v=}')
        a = [t[i] != x for i, x in enumerate(s[v:len(t)+v])]
        print(s[v:v + len(t) - v])
        print(a)
        print(s[v:len(t)+v])
        if sum(a) < ans:
            ans = sum(a)
    print(ans)


if __name__ == '__main__':
    Qb()


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

    ans = len(t)
    for v in range(len(s) - len(t) + 1):
        a = [t[i] != x for i, x in enumerate(s[v:len(t)+v])]
        if sum(a) < ans:
            ans = sum(a)
    print(ans)


if __name__ == '__main__':
    Qb()


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
S = input()
T = input()
s = len(S)
t = len(T)

count = 0
max = 0

for i in range(s-t):
  for j in range(t):
    if S[j] == T[j]:
      count += 1
    if count > max:
      max = count
      count = 0
    else:
      count = 0

print(t-max)

S = input()
T = input()
s = len(S)
t = len(T)

count = 0
max = 0

for i in range(s-t+1):
  for j in range(t):
    if S[i+j] == T[j]:
      count += 1
  if count > max:
    max = count
    count = 0
  else:
    count = 0

print(t-max)

Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
vs = input()
t = input()

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

s = input()
t = input()

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


Verdicts: Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
s = input()
t = input()

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

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

diff = t_l - max_count
print(diff)


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)

s = input()
t = input()

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

max_count = 0
for i in range(0, s_l - t_l + 1):
  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)


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
import numpy as np
s = np.array(list(input()))
t = np.array(list(input()))
s_sub = np.array(list((s[i:i+len(t)] for i in range(len(s)-len(t)+1))))
print(s_sub)
ans = [0]*len(s_sub)
for i in range(len(s_sub)):
    ans[i] = np.count_nonzero(s_sub[i] == t)
print(len(t)-max(ans))

import numpy as np
s = np.array(list(input()))
t = np.array(list(input()))
s_sub = np.array(list((s[i:i+len(t)] for i in range(len(s)-len(t)+1))))
ans = [0]*len(s_sub)
for i in range(len(s_sub)):
    ans[i] = np.count_nonzero(s_sub[i] == t)
print(len(t)-max(ans))


Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
S = input()
T = input()

z = len(S)-len(T)

res = []
cnt = 0
if z == 0:
  for a,b in zip(S,T):
    if a != b:
      cnt += 1
print(cnt);exit()
    
for i in range(z):
  s = S[i:i+len(T)]
  cnt = 0
  for j,k in zip(s,T):
    if j != k:
      cnt += 1
  res.append(cnt)

print(min(res))

S = input()
T = input()

z = len(S)-len(T)

res = []
cnt = 0
if z == 0:
  for a,b in zip(S,T):
    if a != b:
      cnt += 1
  print(cnt)
  exit();
else:
  for i in range(z):
    s = S[i:i+len(T)]
    cnt = 0
    for j,k in zip(s,T):
      if j != k:
        cnt += 1
    res.append(cnt)
  print(min(res))


Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
a=str(input())
b=str(input())
ans=0
c=[]
l=0
for x in range(len(a)-len(b)+1):
    ans=0
    for i in range(len(b)):
       if a[i+l]!=b[i]:
           ans+=1
    l+=1
    c.append(ans)
print(c)
print(min(c))

a=str(input())
b=str(input())
ans=0
c=[]
l=0
for x in range(len(a)-len(b)+1):
    ans=0
    for i in range(len(b)):
       if a[i+l]!=b[i]:
           ans+=1
    l+=1
    c.append(ans)
print(min(c))

Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
# coding: utf-8

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

    ans = len(t)
    
    for i in range(len(s) - len(t) + 1):
        a = s[i:i+len(t)]
        print(a, t)
        ans_list = [1 for x, y in zip(a, t) if x!=y]
        tmp_ans = sum(ans_list)
        ans = min(ans, tmp_ans)
        
        if ans == 0:
            break
        
    print(ans)
    
        

main()

# coding: utf-8

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

    ans = len(t)
    
    for i in range(len(s) - len(t)):
        a = s[i:i+len(t)]
        print(a, t)
        ans_list = [1 for x, y in zip(a, t) if x!=y]
        tmp_ans = sum(ans_list)
        ans = min(ans, tmp_ans)
        
        if ans == 0:
            break
        
    print(ans)
    
        

main()

# coding: utf-8

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

    ans = len(t)
    
    for i in range(len(s) - len(t) + 1):
        a = s[i:i+len(t)]
        # print(a, t)
        ans_list = [1 for x, y in zip(a, t) if x!=y]
        tmp_ans = sum(ans_list)
        ans = min(ans, tmp_ans)
        
        if ans == 0:
            break
        
    print(ans)
    
        

main()

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
s = input()
t = input()
N = len(t)
count = 0
for i in range(N):
  if t[i] in s[i]:
    count += 1

print(count)

s = input()
t = input()
N = len(t)
count = 0
for i in range(N):
  if t[i] != s[i]:
    count += 1

print(count)

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
s = input().split()
S = s[0]
T = s[1]

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



S = input()
T = input()

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



S = input()
T = input()

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

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
S = input()
T = input()
ans=float('inf')
for start in range(len(S) - len(T)):
    ans = min(ans, sum(s != t for s, t in zip(S, T)))
print(ans)


S = input()
T = input()
ans = float('inf')
for start in range(len(S) - len(T) + 1):
    ans = min(ans, sum(s != t for s, t in zip(S[start:], T)))
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
s = input()
t = input()
ls = len(s)
lt = len(t)
max_count = 0
for i in range(ls-lt+1):
  count = 0
  for j in range(lt):
    if s[i:i+lt][j] == t[j]:
      count += 1
  if max_count < count:
    max_count = count
print(max_count)

s = input()
t = input()
ls = len(s)
lt = len(t)
max_count = 0
for i in range(ls-lt+1):
  count = 0
  for j in range(lt):
    if s[i:i+lt][j] != t[j]:
      count += 1
  if max_count < count:
    max_count = count
print(max_count)

s = input()
t = input()
ls = len(s)
lt = len(t)
min_count = 1000
for i in range(ls-lt+1):
  count = 0
  for j in range(lt):
    if s[i:i+lt][j] != t[j]:
      count += 1
  if min_count > count:
    min_count = count
print(min_count)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
s = input()
t = input()

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

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

Verdicts: Runtime Error

Accepted
Problem: 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`.

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


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


Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
S = input()
T = input()

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

S = input()
T = input()

ans = len(T)

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

Verdicts: Runtime Error

Accepted
Problem: 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`.

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
S = input()
T = input()

ans = 0
l = len(T)
for m in range (len(S)-l):
    diff = 0
    for i in range (l):
        if S[m+i] != T[i]:
            diff+=1
    ans = min(ans, diff)

print(ans)

S = input()
T = input()

ans = 0
l = len(T)
for m in range (len(S)-l):
    diff = 0
    for i in range (l):
        if S[m+i] != T[i]:
            diff+=1
    ans = max(ans, diff)

print(ans)

S = input()
T = input()

ans = len(T)
l = len(T)
for m in range (len(S)-l+1):
    diff = 0
    for i in range (l):
        if S[m+i] != T[i]:
            diff+=1
    ans = min(ans, diff)

print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
s = input()
t = input()
ans = len(t)

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

s = input()
t = input()
ans = len(t)
 
for i in range(len(s)):
  if (i + len(t) > len(s)): break
  dif = 0
  for j in range(len(t)):
    if (s[i + j] != t[j]):
      dif += 1
  ans = min(ans, dif)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
s = input()
t = input()
list = []

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


s = input()
t = input()
list = []

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


s = input()
t = input()
list = []

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


s = input()
t = input()
list = []

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



s = input()
t = input()
list = []

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


s = input()
t = input()
list = []

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


s = input()
t = input()
list = []

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


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
import numpy as np
import sys

S = input()
T = input()

counter = 0
max_counter = 0

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

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

import numpy as np
import sys

S = input()
T = input()

counter = 0
max_counter = 0

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

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

import numpy as np
import sys

S = input()
T = input()

counter = 0
max_counter = 0

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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`.

Submission attempts (in order):
S=input()
T=input()
s=len(S)
t=len(T)
max_count=0
count=0
for i in range(s-t+1):
  for j in range(t):
    if T[i]==S[j+i]:
      count += 1
  max_count=max(max_count,count)
  count=0  
print(t-max_count)

S=input()
T=input()
s=len(S)
t=len(T)
max_count=0

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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`.

Submission attempts (in order):
def solve(s, t):
    n = len(s)
    m = len(t)
    best = m
    for i in range(m-n+1):
        num = 0
        for j in range(n):
            if s[j] == t[i+j]:
                num += 1
        best = min(best, num)
    return best
    
s = input()
t = input()
print(solve(s, t))

def solve(s, t):
    n = len(s)
    m = len(t)
    best = m
    for i in range(n-m+1):
        num = 0
        for j in range(m):
            if s[i+j] != t[j]:
                num += 1
        best = min(best, num)
    return best

s = input()
t = input()
print(solve(s, t))


Verdicts: Wrong Answer

Accepted