ZhenlongDai/ACPR huggingface dataset:
Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
t = input()

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

print(len(t) - max(cnt))


Failing test case input:
cpdefsqbeo
ctdqfao

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
s = input()
t = input()

cnt = []
for i in range(len(s) - len(t) + 1):
    cnt1 = 0
    for k in range(len(t)):
        if t[k] == s[i: i + len(t)][k]:
            cnt1 += 1
            cnt.append(cnt1)
            
    else:
        cnt.append(0)
            

print(len(t) - max(cnt))

Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
s = input()
t = input()
m = 0
ans = 0
for i in range(len(s)-len(t)+1):
    c = 0
    for j in range(len(t)):
        if s[i+j] == t[j]:
            c += 1
    if c > m:
        m = c
        ans = len(t) - c

print(ans)

Failing test case input:
c`bcce
aaa

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
s = input()
t = input()
m = 0
ans = 0
for i in range(len(s)-len(t)+1):
    c = 0
    for j in range(len(t)):
        if s[i+j] == t[j]:
            c += 1
    if c >= m:
        m = c
        ans = len(t) - c

print(ans)

Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):

long=input()


short=input()

maximum_same=0
for i in range(len(long)-len(short)):
  newLong=long[i:i+len(short)]
  same=0
  for j in range(len(short)):
    if newLong[j]==short[j]:
      same+=1
  if same>maximum_same:
    maximum_same=same

print(len(short)-maximum_same)

Failing test case input:
e`bccc
caa

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):

long=input()
 

short=input()
 
maximum_same=0
for i in range(len(long)-len(short)+1):
  newLong=long[i:i+len(short)]
  
  
  same=0
  for j in range(len(short)):
    if newLong[j]==short[j]:
      same+=1
  if same>maximum_same:
    maximum_same=same
 
print(len(short)-maximum_same)

Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
s = input()
t = input()
n = len(s)
m = len(t)
a,x = m,m
for i in range(n-m):
  x=m
  for j in range(m):
    x -= s[i+j] == t[j]
  a = min(a,x)
print(a)

Failing test case input:
oeaqsdefpc
btdqep_

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
s = input()
t = input()
n = len(s)
m = len(t)
a,x = m,m
for i in range(n-m+1):
  x=m
  for j in range(m):
    x -= s[i+j] == t[j]
  a = min(a,x)
print(a)
Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S=input()
T=input()

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

print(len(T)-num_char)

Failing test case input:
dc`cbc
`ab

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
S=input()
T=input()

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


print(len(T)-best_num_char)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
t = input()

ans = 100000

n = len(s)
m = len(t)

for i in range(n - m + 2):
    temp = s[i:i + m]
    count = 0
    for a, b in zip(temp, t):
        if a != b:
            count += 1
    ans = min(count, ans)

print(ans)


Failing test case input:
cpfedsqaeo
btdqep_

Expected output:
6


Actual output:
5


Fixed submission (verdict: Accepted):
s = input()
t = input()

ans = 100000

n = len(s)
m = len(t)

for i in range(n - m + 1):
    temp = s[i:i + m]
    count = 0
    for a, b in zip(temp, t):
        if a != b:
            count += 1
    ans = min(count, ans)

print(ans)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = str(input())
T = str(input())
lenS = len(S)
lenT = len(T)
max_match = 0
for idx in range(lenS - lenT + 1):
    cnt_match = 0
    for i in range(lenT - 1):
        if S[idx + i] == T[i]:
            cnt_match += 1
    if cnt_match > max_match:
        max_match = cnt_match
print(lenT - max_match)



Failing test case input:
ccbaac
aac

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
S = str(input())
T = str(input())
lenS = len(S)
lenT = len(T)
max_match = 0
for idx in range(lenS - lenT + 1):
    cnt_match = 0
    for i in range(lenT):
        if S[idx + i] == T[i]:
            cnt_match += 1
    if cnt_match > max_match:
        max_match = cnt_match
print(lenT - max_match)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
string1 = input()
string2 = input()

n, m = len(string1), len(string2)
best = float("inf")
for i in range(n - m):
  current = string1[i:i+m]
  differences = 0
  for i in range(m):
    if current[i] != string2[i]:
      differences += 1
  best = min(differences, best)
  
print(best)

Failing test case input:
apfeeqsceo
btprcda

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):
string1 = input()
string2 = input()

n, m = len(string1), len(string2)
best = float("inf")
for i in range(n - m + 1):
  current = string1[i:i+m]
  differences = 0
  for i in range(m):
    if current[i] != string2[i]:
      differences += 1
  best = min(differences, best)

if best == float("inf"):
  print(0)
else:
  print(best)
Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import re
s = input()
t = input()
t_list = list(t)
ans = len(t)

for start in range(len(s) - len(t)):
    diff = 0
    for i in range(len(t)):
        if(t_list[i] != s[start + i]):
            diff += 1
        
    ans = min(ans, diff)

print(ans)

Failing test case input:
apfeesrceo
cdarotb

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):
s = input()
t_list = list(input())
ans = len(t_list)

for start in range(len(s) - len(t_list) + 1):
    diff = 0
    for i in range(len(t_list)):
        if(t_list[i] != s[start + i]):
            diff += 1
        
    ans = min(ans, diff)

print(ans)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
apfedsqceo
btprcda

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):
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+1):
        cnt = 0
        for j in range(tlen):
            if T[j]!=S[i+j]:
                cnt += 1
        
        if ansCnt>cnt:
            ansCnt = cnt

    print(ansCnt)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()
t=input()
ans=10*3+1
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(ans)


Failing test case input:
oecqsdefpa
btdqdpa

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
s=input()
t=input()
ans=10**3+1
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)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):



S=input()
T=input()

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

m=0

for i in range (Slen-Tlen):
    temp=0
    for j in range (Tlen):
        if T[j]==S[i+j]:
            temp+=1
        
        if temp>m:
            m=temp

print(Tlen-m)

        


Failing test case input:
apfeeqsceo
btprcda

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):



S=input()
T=input()

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

m=0

for i in range (Slen-Tlen+1):
    temp=0
    for j in range (Tlen):
        if T[j]==S[i+j]:
            temp+=1
        else:
            continue
    else:
        if temp>m:
            m=temp
print(Tlen-m)
Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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(min(a))

Failing test case input:
apfeesrceo
cdarotb

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):
s=str(input())
t=str(input())
n=len(t)
m=len(s)
a=[]
if t in s:
  print(0)
else:
  for i in range(m-n+1): 
    ans=0
    for j in range(n):
      if s[i+j]!=t[j]:
        ans+=1
    a.append(ans)
  print(min(a))

Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
S = input().strip()
T = input().strip()


N = len(S)
M = len(T)

ans = 10**10
for i in range(N-M):
    subS = S[i:i+M]
    temp = 0
    for s,t in zip(subS, T):
        if s != t:
            temp += 1
    ans = min(temp,ans)

print(ans)


Failing test case input:
codefsrceo
atdrceo

Expected output:
3


Actual output:
6


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
S = input().strip()
T = input().strip()


N = len(S)
M = len(T)

ans = 10**10
for i in range(N-M+1):
    subS = S[i:i+M]
    temp = 0
    for s,t in zip(subS, T):
        if s != t:
            temp += 1
    ans = min(temp,ans)

print(ans)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
T = input()
len_S = len(S)
len_T = len(T)
N = len_S-len_T+1
max_cnt = 0
for i in range(N):
    cnt = 0
    for j in range(len_T):
        if S[i+j]==T[j]:
            cnt+=1
            if j==len_T-1:
                if max_cnt<cnt:
                    max_cnt=cnt
        else:
            if max_cnt<cnt:
                max_cnt=cnt
            cnt=0
print(len_T-max_cnt)

Failing test case input:
cpfedsqbdo
pafqdtb

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
S = input()
T = input()
len_S = len(S)
len_T = len(T)
N = len_S-len_T+1
max_cnt = 0
for i in range(N):
    cnt = 0
    for j in range(len_T):
        if S[i+j]==T[j]:
            cnt+=1
        if j==len_T-1:
            if max_cnt<cnt:
                max_cnt=cnt
print(len_T-max_cnt)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = list(input())
t = list(input())
ans = len(t)

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

    ans = min(ans, tmp)

print(ans)


Failing test case input:
e`bccc
caa

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
s = list(input())
t = list(input())
ans = len(t)

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

    ans = min(ans, tmp)

print(ans)
Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
S=input()
T=input()
A = []

for i in range(len(T)):           
    for j in range(i,len(T)):
        SS = S[i:j]
        if SS in T:
               A.append(j-i+1)
p = min(A)
print(p)

Failing test case input:
oecrseefpa
btoradc

Expected output:
6


Actual output:
1


Fixed submission (verdict: Accepted):
S = input()
T = input()
lS = len(S)
lT = len(T)
C = []
for i in range(lS-lT+1):
    count = 0
    for j in range(lT):
        if S[i+j]!=T[j]:
            count += 1
    C.append(count)
print(min(C))

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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))



Failing test case input:
cbcaac
bba

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
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))

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S=input()
T=input()
cnt=0
ans=0
for i in range(len(T)):
    for j in range(len(S)):
        if T[i] ==S[j]:
            cnt+=1
            break
        cnt = 0
    ans = max(ans, cnt)
    
print(len(T)-ans)

Failing test case input:
oecrseefpa
btdraod

Expected output:
6


Actual output:
5


Fixed submission (verdict: Accepted):
S=input()
T=input()
cnt=0
ans=len(T)
 
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)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
T = input()

ans = len(T)

l_diff = []

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

Failing test case input:
apfedsqceo
btpqcda

Expected output:
5


Actual output:
7


Fixed submission (verdict: Accepted):
S = input()
T = input()

ans = len(T)

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

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
T = input()
ans = len(T)
n1 = len(S)-len(T)
for i in range(n1):
    ans2 = 0
    for k in range(len(T)):
        
        if S[k+i] != T[k]:
            ans2 += 1
    
    ans = min([ans,ans2])
    
print(ans)

Failing test case input:
e`bccc
caa

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
S = input()
T = input()
ans = len(T)
n1 = len(S)-len(T)+1
for i in range(n1):
    ans2 = 0
    for k in range(len(T)):
        
        if S[k+i] != T[k]:
            ans2 += 1
    
    ans = min([ans,ans2])
    
print(ans)
Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
S = list(input())
T = list(input())
r = len(S) - len(T)
min = float('inf') if T in S else 0
for i in range(r):
    t = 0
    for j, v in enumerate(T):
        t += int(S[i+j] != v)
    if min > t:
        min = t

print(min)


Failing test case input:
c`bcce
aaa

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
S = input()
T = input()
if S.find(T) != -1:
    min = 0
else:
    min = float('inf')
    r = len(S) - len(T)
    for i in range(r+1):
        t = 0
        for j, v in enumerate(T):
            t += int(S[i+j] != v)
        if min > t:
            min = t

print(min)

Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
S = input()
T = input()
L,l = len(S),len(T)
ans = 1000
for i in range(l,L):
    s = S[i-l:i]
    cnt = 0
    for j in range(l):
        if s[j] != T[j]:
            cnt += 1
    if ans > cnt:
        ans = cnt
print(ans)

Failing test case input:
apfeeqsceo
btprcda

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):
S = input()
T = input()
L,l = len(S),len(T)
ans = 1000
for i in range(l,L+1):
    s = S[i-l:i]
    cnt = 0
    for j in range(l):
        if s[j] != T[j]:
            cnt += 1
    if ans > cnt:
        ans = cnt
print(ans)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = str(input())
T = str(input())

result =0

cnt = len(T)

temp = S[:cnt]

Min = len(T)

while True:
    sum = 0
    
    for i in range (len(T)):
        if temp[i] != T[i]:
            sum+=1
    
    Min = min(Min,sum)
    
    if cnt+len(T) <= len(S):
        temp = S[cnt:cnt+len(T)]
        cnt = cnt+len(T)
    else:
        break
    
    
print(Min)
    
    
    

Failing test case input:
codefsrceo
atdrceo

Expected output:
3


Actual output:
6


Fixed submission (verdict: Accepted):
S = str(input())
T = str(input())

result =0
index = 0
Min = len(T)

while True:
    sum = 0
    temp = S[index : index + len(T)]
    
    for i in range (len(T)):
        if temp[i] != T[i]:
            sum+=1
    
    Min = min(Min,sum)
    
    index +=1
    
    if index + len(T) >  len(S):
        break
    
print(Min)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
t = input()

ans = 1000000
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 = min(ans, cnt)

print(ans)


Failing test case input:
cbc`cd
`ab

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
s = input()
t = input()

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

    ans = min(ans, cnt)

print(ans)
Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


s = input()
t = input()

def distance(s, t):
    assert(len(s) == len(t))
    return len(s) - sum([c1 == c2 for c1, c2 in zip(s, t)])


min_d = len(s)

for i in range(len(s) - len(t)):
    min_d = min(min_d, distance(s[i:i+len(t)], t))

print(min_d)


Failing test case input:
cbc`cd
`aa

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):


s = input()
t = input()

def distance(s, t):
    assert(len(s) == len(t))
    return len(s) - sum([c1 == c2 for c1, c2 in zip(s, t)])


min_d = len(s)

for i in range(len(s) - len(t) + 1):
    min_d = min(min_d, distance(s[i:i+len(t)], t))

print(min_d)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
t = input()



















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]:
            dif += 1
    ans = min(dif,ans)

print(ans)     

Failing test case input:
apfedqsceo
btprcda

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):
s = input()
t = input()



















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)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
t = input()

s_len = len(s)
t_len = len(t)

ans = s_len
for i in range(s_len - t_len + 1):
    c = 0
    for j in range(t_len):
        if s[i+j] == t[j]:
            c += 1
    ans = max(ans, c)
print(t_len - ans)

Failing test case input:
codefsqceo
atdrfco

Expected output:
5


Actual output:
-3


Fixed submission (verdict: Accepted):
S = input()
T = input()
ans = 0
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
  ans = max(ans, count)
print(len(T) - ans)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
T = input()

ans = 0
for i in range(len(T)):
    for j in range(1, len(T)+1):
        if i >= j:
            continue

        if T[i:j] in S[i:j]:
            ans = max(ans, j-i)

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

Failing test case input:
apfeeqsceo
btprcda

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):
S = input()
T = input()
ans = len(T)
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)
Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input().rstrip()
t = input().rstrip()
count = 0
min_count = 10000
for i in range(len(s) - len(t)):
    s_selected = s[i:i + len(t)]
    count = 0
    for j in range(len(t)):
        if t[j] != s_selected[j]:
            count += 1
    
    if count < min_count:
        min_count = count
print(min_count)

Failing test case input:
e`bccc
caa

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
s = input().rstrip()
t = input().rstrip()
count = 0
min_count = 10000
for i in range(len(s) - len(t) + 1):
    s_selected = s[i:i + len(t)]
    
    count = 0
    for j in range(len(t)):
        if t[j] != s_selected[j]:
            count += 1
    
    if count < min_count:
        min_count = count
print(min_count)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
T = input()

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

print(ans)



Failing test case input:
apfeesrceo
cdarotb

Expected output:
6


Actual output:
0


Fixed submission (verdict: Accepted):
S = input()
T = input()

max = 0
max_i = 0
ans = len(T)
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 cnt > max:
        max = cnt
        max_i = i
        ans = len(T) - max

print(ans)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = str(input())
T = str(input())

result =0

cnt = len(T)

temp = S[:cnt]

Min  = len(T)

while True:
    sum = 0
    for i in range (len(T)):
        if temp[i] != T[i]:
            sum+=1
    
    result = min(Min,sum)
    
    if cnt+len(T) <= len(S):
        temp = S[cnt:cnt+len(T)]
        cnt = cnt+len(T)
    else:
        break
    
    
print(result)
    

Failing test case input:
dc`cbc
`ab

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
S = str(input())
T = str(input())

result =0
index = 0
Min = len(T)

while True:
    sum = 0
    temp = S[index : index + len(T)]
    
    for i in range (len(T)):
        if temp[i] != T[i]:
            sum+=1
    
    Min = min(Min,sum)
    
    index +=1
    
    if index + len(T) >  len(S):
        break
    
print(Min)

Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
S,T = input(),input()
ans = len(T)

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

Failing test case input:
apfedqsceo
btprcda

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):
S,T = input(),input()
ans = len(T)

for i in range(len(S)-len(T)+1):
    sum = 0
    for j in range(len(T)):
        if S[i+j] == T[j]:sum+=1
        
    ans = min(ans,len(T)-sum)
print(ans)
Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
t = input()
minimam = 1000

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


print(minimam)


Failing test case input:
oecqsdefpa
btdqepa

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
s = input()
t = input()
minimam = 10000

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


print(minimam)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
T = input()
ans = float('inf')
for i2 in range(len(T)):
    if i2 + len(T) > len(S):
        break
    ans = min(ans, sum(S[i1] != T[i1 - i2] for i1 in range(i2, i2 + len(T))))
print(ans)


Failing test case input:
cbc`cd
`aa

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
S = input()
T = input()
ans = float('inf')
for i2 in range(len(S)):
    if i2 + len(T) > len(S):
        break
    ans = min(ans, sum(S[i1] != T[i1 - i2] for i1 in range(i2, i2 + len(T))))
print(ans)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S=list(input())
T=list(input())

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


Failing test case input:
c`bcce
a`a

Expected output:
2


Actual output:
['c', '`', 'b']
['`', 'b', 'c']
['b', 'c', 'c']
['c', 'c', 'e']
3


Fixed submission (verdict: Accepted):
S=list(input())
T=list(input())
 
num=1000
for i in range(len(S)-len(T)+1):
    s = S[i:i+len(T)]
    cnt = 0
    for j in range(len(T)):
        if s[j]!=T[j]:
            cnt+=1
    num=min(num, cnt)
print(num)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
T = input()
n = len(S)

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


Failing test case input:
apfedsqceo
btdqcpa

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
S = input()
T = input()
n = len(S)

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

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
T = input()

m = len(S)
n = len(T)

ans = n
for i in range(m - n):
    d = 0
    for j in range(n):
        if S[i + j] != T[j]:
            d += 1
    if ans > d:
        ans = d
print(ans)

Failing test case input:
apfeeqsceo
btorcda

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):
S = input()
T = input()

m = len(S)
n = len(T)

ans = n
for i in range(m - n + 1):
    d = 0
    for j in range(n):
        if S[i + j] != T[j]:
            d += 1
    if ans > d:
        ans = d
print(ans)
Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
t = input()
lt = len(t)

def dif(s, t):
    count = 0
    for i in range(lt):
        if s[i] != t[i]:
            count += 1
    return count

if t in s: print(0)
else:
    ans = float('inf')
    for i in range(len(s)-lt):
        ans = min(ans, dif(s[i:i+lt], t))
    print(ans)

Failing test case input:
apfeesrceo
cdarotb

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):
s = input()
t = input()
lt = len(t)

def dif(s, t):
    count = 0
    for i in range(lt):
        if s[i] != t[i]:
            count += 1
    return count

if t in s: print(0)
else:
    ans = float('inf')
    for i in range(len(s)-lt+1):
        ans = min(ans, dif(s[i:i+lt], t))
    print(ans)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

import sys
s = input()
t = input()
length = 0
ans = [0]*(len(s)-len(t)+1)
for i in range(len(s)-len(t)):
    for j in range(len(t)):
        if s[i+j] == t[j]:
            ans[i] += 1
print(len(t)-max(ans))


Failing test case input:
oeaqsdefpc
btdqep_

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):

import sys
s = input()
t = input()
length = 0
ans = [0]*(len(s)-len(t)+1)
for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if s[i+j] == t[j]:
            ans[i] += 1
print(len(t)-max(ans))

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    S = str(input())
    T = str(input())
    
    ans = len(T)
    for i in range(len(S)-len(T)):
        count = 0
        for j in range(len(T)):
            if S[i+j] != T[j]:
                count += 1
        if count <= ans:
            ans = count
    
    print(ans)
    
if __name__ == '__main__':
    main()

Failing test case input:
apfedsqceo
btprcda

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):
def main():
    S = str(input())
    T = str(input())
    
    ans = len(T)
    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
        if count <= ans:
            ans = count
    
    print(ans)
    
if __name__ == '__main__':
    main()

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = list(input())
N = len(S)
T = list(input())
n = len(T)
ans = n
for i in range(N - n):
    s = S[i:i + n]
    a = 0
    for j in range(n):
        if T[j] != s[j]:
            a += 1
    if a < ans:
        ans = a
print(ans)

Failing test case input:
oecqsdefpa
btdqep`

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
S = list(input())
N = len(S)
T = list(input())
n = len(T)
ans = n
for i in range(N - n + 1):
    s = S[i:i + n]
    a = 0
    for j in range(n):
        if T[j] != s[j]:
            a += 1
    if a < ans:
        ans = a
print(ans)
Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import random, string
S = input()
T = input()
l = len(T)
L = len(S)
max_ans = -1
for i in range(L):
   if i + l > L:
      continue
   for j in range(l):
      ans = 0
      if T[j] == S[i + j]:
            ans += 1
   max_ans = max(max_ans, ans)
print(l - max_ans)

Failing test case input:
c`cbce
a`a

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):

import random, string
S = input()
T = input()
l = len(T)
L = len(S)
max_ans = -1
for i in range(L):
   ans = 0
   if i + l > L:
      continue
   for j in range(l):
      if T[j] == S[i + j]:
            ans += 1
   max_ans = max(max_ans, ans)
print(l - max_ans)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)


Failing test case input:
cabaac
aab

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
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)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = str(input())
T = str(input())

lS = len(S)
lT = len(T)
q = 0

print(S,lS,T,lT)

for i in range(0,lS-lT+1):
    p = 0
    for j in range(0, lT):
        if S[i+j] == T[j]:
            p += 1
    print("p", p, "q", q)
    q = max(q, p)
ans = lT-q
print(ans)

Failing test case input:
oecqsdefpa
btdqepa

Expected output:
4


Actual output:
oecqsdefpa 10 btdqepa 7
p 1 q 0
p 0 q 1
p 1 q 1
p 3 q 1
4


Fixed submission (verdict: Accepted):
S = str(input())
T = str(input())

lS = len(S)
lT = len(T)
q = 0

for i in range(0,lS-lT+1):
    p = 0
    for j in range(0, lT):
        if S[i+j] == T[j]:
            p += 1
    q = max(q, p)
ans = lT-q
print(ans)

Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):

import math
import bisect
import copy
import time
from collections import Counter
from itertools import combinations


s=input()
x=input()
if x in s:
	print(0)
else:
	ans=10**9
	for i in range(len(s)-len(x)):
		c=0
		for j in range(len(x)):
			if s[i+j]!=x[j]:
				c+=1
		ans=min(ans,c)
	print(ans)






Failing test case input:
apfeeqsceo
btprcda

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):

import math
import bisect
import copy
import time
from collections import Counter
from itertools import combinations


s=input()
x=input()
if x in s:
	print(0)
else:
	ans=10**9
	for i in range(len(s)-len(x)+1):
		c=0
		for j in range(len(x)):
			if s[i+j]!=x[j]:
				c+=1
		ans=min(ans,c)
	print(ans)
Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
S = input()
T = input()

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


Failing test case input:
f`bccc
caa

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
S = input()
T = input()

maxtmp = 0
if len(S) == 1:
    if T in S:
        print(0)
    else:
        print(1)
else:
    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
        if maxtmp < tmp:
            maxtmp = tmp
    print(len(T) - maxtmp)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

def input_from_console():
    s = input()
    t = input()
    return s, t


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


def main():
    s, t = input_from_console()
    print(s,t)
    print(solve(s, t))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  
        check_cases()
    else:
        main()

Failing test case input:
cbbaac
bba

Expected output:
0


Actual output:
cbbaac bba
0


Fixed submission (verdict: Accepted):
def input_from_console():
    s = input()
    t = input()
    return s, t


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


def main():
    s, t = input_from_console()
    print(solve(s, t))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  
        check_cases()
    else:
        main()

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
t = input()
minimam = 10000

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


print(minimam)


Failing test case input:
oecqsdefpa
btdqepa

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
s = input()
t = input()
minimam = 10000

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


print(minimam)
Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
oecrseefpa
btdraoc

Expected output:
6


Actual output:
o b
e t
c d
r r
s a
e o
e c
e b
c t
r d
s r
e a
e o
f c
c b
r t
s d
e r
e a
f o
p c
r b
s t
e d
e r
f a
p o
a c
6


Fixed submission (verdict: Accepted):
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)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
t = input()
m = len(t)
for i in range(len(s)-len(t)+1):
    c = 0
    target = list(s[i:i+len(t)])
    for j in range(len(target)):
        if not target[j] == t[j]:
            c += 1
    if c < m :
        m = c
print(c)

Failing test case input:
ccabac
abb

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
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)]
    
    for j in range(len(t)):
        
        if not target[j] == t[j]:
            c += 1
    
    if c < m :
        m = c
print(m)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

S = input()
T = input()

if len(S)>=(len(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)

Failing test case input:
cpdefsqceo
atdqfco

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
S = input()
T = input()

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

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

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = str(input())
T = str(input())
temp = ""
tempcount=0
mincount = 0

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

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



Failing test case input:
apfeeqsceo
btprcda

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):
S = str(input())
T = str(input())
tempcount = 0
mincount = 0

for i in range(len(S) - len(T)+1):
    for j in range(len(T)):
        if S[i + j] != T[j]:
            tempcount += 1
    if i == 0:
        mincount = tempcount
    elif tempcount < mincount:
        mincount = tempcount
    tempcount = 0
    
print(mincount)
Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
s = input()
t = input()

ans = 1000

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 = min(ans, count)
  
print(ans)

Failing test case input:
oecqsdefpa
btdqdpa

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
s = input()
t = input()

ans = 1000

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

Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
S = input()
T = input()

ans = len(T)

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


Failing test case input:
cbacbc
a`b

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
S = input()
T = input()

ans = len(T)

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

Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
S = input()
T = input()
if S.find(T) != -1:
    min = 0
else:
    min = float('inf')
    r = len(S) - len(T)
    for i in range(r):
        t = 0
        for j, v in enumerate(T):
            t += int(S[i+j] != v)
        if min > t:
            min = t

print(min)


Failing test case input:
oeaqsdefpc
btdqep_

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
S = input()
T = input()
if S.find(T) != -1:
    min = 0
else:
    min = float('inf')
    r = len(S) - len(T)
    for i in range(r+1):
        t = 0
        for j, v in enumerate(T):
            t += int(S[i+j] != v)
        if min > t:
            min = t

print(min)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
t = input()
maxi = 0 
if t not in s:
    for i in range(len(s)):
        maxG = 0
        for l, j in zip(s[i:len(t)], t):
            if l == j:
                maxG += 1
        maxi = max(maxi, maxG)
    print(len(t)-maxi)
else:
    print("0")


Failing test case input:
cacabc
`ab

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
s = input()
t = input()
maxi = 0 
for i in range(len(s)):
    maxG = 0
    if len(s[i:len(t)+i]) >= len(t):
        for l, j in zip(s[i:len(t)+i], t):
            if l == j:
                maxG += 1
        maxi = max(maxi, maxG)
print(len(t)-maxi)
Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

S=input()
T=input()
check=[]
for i,tt in enumerate(T):
    check.append(0)
    for ss in S[i:-(len(T)-i)]:
        if ss==tt:
            check[i]+=1

print(len(T)-max(check))

Failing test case input:
cpdefsqceo
csdqfao

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):

S=input()
T=input()
check=[]
for i in range(len(S)-len(T)+1):
    check.append(0)
    for j,tt in enumerate(T):
        if tt==S[i+j]:
            check[i]+=1

check.append(0)

print(len(T)-max(check))

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s, t = input(), input()
i, j = 0, 0
longest = 0
for i in range(len(s)-len(t)):
    count = sum([s[i+j] == t[j] for j in range(len(t))])
    longest = max(longest, count)
print(len(t)-longest)


Failing test case input:
codefsqceo
atdrceo

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
s, t = input(), input()
i, j = 0, 0
longest = 0
for i in range(len(s)-len(t)+1):
    count = sum([s[i+j] == t[j] for j in range(len(t))])
    longest = max(longest, count)
print(len(t)-longest)

Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
S = input()
T = input()

res = len(T)
for i in range(len(S)-len(T)):
  target = S[i:i+len(T)]

  matchCount = 0
  for s, t in zip(T, target):
    if s == t:
      matchCount += 1
  res = min(res, len(T)-matchCount)

print(res)

Failing test case input:
oeaqsdefpc
btdqep`

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
S = input()
T = input()

res = len(T)
for i in range(len(S)-len(T)+1):
  target = S[i:i+len(T)]

  matchCount = 0
  for s, t in zip(T, target):
    if s == t:
      matchCount += 1
  res = min(res, len(T)-matchCount)

print(res)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
T = input()
C = []
if len(S) == len(T):
  c = 0
  for j in range(len(T)):
      if S[j] == T[j]:
        c += 1
  C.append(c)
else:
  for i in range(len(S) - len(T)+1):
    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))
   
    

Failing test case input:
dc`cbc
`ab

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
S = input()
T = input()
C = []
if len(S) == len(T):
  c = 0
  for j in range(len(T)):
      if S[j] == T[j]:
        c += 1
  C.append(c)
else:
  for i in range(len(S) - len(T)+1):
    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))
Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()
t=input()

result = 0
for i in range(len(s)):
  count = 0
  flg = False
  for j in range(len(t)):
    if i+j > len(s)-1:
      break
    if t[j] == s[i+j]:
      flg = True
    else:
      flg = False

    if flg:
      count += 1
      
  result = max(result,count)
print(len(t)-result)

Failing test case input:
oeectfpcat
albs`tb

Expected output:
7


Actual output:
6


Fixed submission (verdict: Accepted):
s=input()
t=input()
 
result = 0
for i in range(len(s)):
  if len(s) < len(t) + i:
    break
  count = 0
  for j in range(len(t)):
    if t[j] == s[i+j]:
      count += 1
      
  result = max(result,count)
print(len(t)-result)

Problem: p02571
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
s=input()
t=input()
q=10**18
ans=0
for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if t[j]!=s[i+j]:
            ans+=1
            ans=min(ans,q)
print(ans)

Failing test case input:
oecqsdefpa
btdqepa

Expected output:
4


Actual output:
23


Fixed submission (verdict: Accepted):
s=input()
t=input()
q=10**18
for i in range(len(s)-len(t)+1):
    ans=0
    for j in range(len(t)):
        if t[j]!=s[i+j]:
            ans+=1
    q=min(ans,q)
print(q)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
T = input()

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

Failing test case input:
cbbaac
aab

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
S = input()
T = input()

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

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

def cout_dif(a, b):
    sum = 0
    for i in range(len(a)):
        if a[i] != b[i]:
            sum += 1
    return sum
    
def main():
    s = input()
    t = input()
    min = 10**5
    for i in range(len(s)-len(t)):
        sum = cout_dif(t, s[i:i+len(t)+1])
        if sum < min:
            min = sum
    print(min)

if __name__ == '__main__':
    main()

Failing test case input:
apfedsqceo
btprcda

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):

def cout_dif(a, b):
    sum = 0
    for i in range(len(a)):
        if a[i] != b[i]:
            sum += 1
    return sum
    
def main():
    s = input()
    t = input()
    min = 10**5
    for i in range(len(s)-len(t)+1):
        sum = cout_dif(t, s[i:i+len(t)])
        if sum < min:
            min = sum
    print(min)

if __name__ == '__main__':
    main()
Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
T = input()

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

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

Failing test case input:
oeaqsdefpc
btdqep`

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
S = input()
T = input()
ans = len(T)
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)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from sys import stdin

def check_str(s,t):
    com = 0
    print(s)
    for a,b in zip(s,t):
        if a == b:
            com += 1
    return com

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

    common = 0
    for i in range(len(s)):
        common = max(common, check_str(s[i:],t))

    print(len(t)-common)

    
if __name__ == "__main__":
    main()

Failing test case input:
cbbaac
aab

Expected output:
1


Actual output:
cbbaac
bbaac
baac
aac
ac
c
1


Fixed submission (verdict: Accepted):
from sys import stdin

def check_str(s,t):
    com = 0
    if len(t) > len(s):
        return 0
    for a,b in zip(s,t):
        if a == b:
            com += 1
    return com

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

    common = 0
    for i in range(len(s)):
        common = max(common, check_str(s[i:],t))

    print(len(t)-common)

    
if __name__ == "__main__":
    main()

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
T = input()
slen = len(S)
tlen = len(T)
ans = 0
for i in range(slen - tlen):
    count = 0
    for j in range(tlen):
        if S[i+j] == T[j]:
            count += 1
    ans = max(ans,count)
print(tlen-ans)

Failing test case input:
codefsqceo
atdrceo

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
S = input()
T = input()
slen = len(S)
tlen = len(T)
ans = 0
for i in range(slen - tlen+1):
    count = 0
    for j in range(tlen):
        if S[i+j] == T[j]:
            count += 1
    ans = max(ans,count)
print(tlen-ans)

Problem: p02571
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S=input()
T=input()
ans=float("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(ans) if ans<float("inf") else print(len(T))

Failing test case input:
oeaqsdefpc
btdqep_

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
S=input()
T=input()
ans=float("inf")
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) if ans<float("inf") else print(len(T))