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

for i in range(len(T), 0, -1):
    for j in range(len(T)-i+1):
        subst = T[j:i+j]
#        print(subst)
        if S.find(subst, j)>=0:
            print (len(T)-i)
            


S = input()
T = input()

for i in range(len(T), 0, -1):
    for j in range(len(T)-i+1):
        subst = T[j:i+j]
#        print(subst)
        if S.find(subst, j, len(S)-(len(T)-i-j))>=0:
            print (len(T)-i)
            print(subst)
#            exit(0)


S = input()
T = input()

for i in range(len(T), 0, -1):
    for j in range(len(T)-i+1):
        subst = T[j:i+j]
        print(subst)
        if S.find(subst, j, len(S)-(len(T)-i-j))>=0:
            print (len(T)-i)
#            print(subst)
            exit(0)



S = input()
T = input()

def matchcount(x, y):
    ret = 0
    for i in range(len(x)):
        if x[i] == y[i]: ret += 1
    return ret

rec = len(T)
for i in range(len(S)-len(T)+1):
    subst = S[i:i+len(T)]
#    print(subst, matchcount(subst, T))
    rec = min(rec, len(T) - matchcount(subst, T))

print(rec)



Verdicts: Wrong Answer

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=input()
t=input()
sz=len(t)
ans=100000000000
for i in range(0,len(s),sz):
    k=s[i:i+sz]
    c=0
    for j in range(sz):
        if s[j]==t[j]:
            c+=1
        else:
            ans=min(ans,sz-c)
ans=min(ans,sz-c)
print(ans)


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


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

count_min = 1000

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

print(count_min)      

s=input()
t=input()

count_min = 1000

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 < count_min:
    count_min = count

print(count_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):
from sys import stdin
def ip(): return [int(i) for i in stdin.readline().split()]
def sp(): return [str(i) for i in stdin.readline().split()]


s = str(input())
t = str(input())

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


from sys import stdin
def ip(): return [int(i) for i in stdin.readline().split()]
def sp(): return [str(i) for i in stdin.readline().split()]


s = str(input())
t = str(input())

ans = len(t)
for i in range(len(s) - len(t) + 1):
    # print(f'{i=} | {ans=}')
    curr = len(t)
    for j in range(i, len(t) + i):
        # print(f'{curr=} | {s[j]=} | {t[j-i]=}')
        if s[j] == t[j-i]:
            curr -= 1
    ans = min(ans, curr)
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, t = input(), input()

lt= len(t)
for i in range(lt):
  is_double = True
  size = lt-i
  for j in range(0,i+1):
    _t = t[j:j+size]
    print(i,j,size,_t)
    if _t in s:
      is_double = False
      break
  if not is_double:
    print(lt-1)
    break
    

s, t = input(), input()

ls = len(s)
lt= len(t)
print(ls,lt)
is_double = False

for i in range(0,lt):
  size = lt-i
  for j in range(0,lt-size+1):
    jps = (j+size)
    # 0 j (j+size) lt
    _t = t[j:jps]
    print(i,j,size,_t, f'\t{s[j:ls-(lt-(j+size))]}')
    if _t in s[j:ls-(lt-(j+size))]:
      is_double = True
      break
  if is_double:
    print(i)
    break

if not is_double:
  print(lt)



s, t = input(), input()

ls = len(s)
lt= len(t)
is_double = False
c = len(s)
for i in range(ls-lt+1):
  _c = 0 
  for j in range(lt):
    if not s[i+j] == t[j]:
      _c +=1
  if c > _c:
    c = _c
    
print(c)

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):
s=input()
t=input()
a = len(s)
b = len(t)
l = []
for i in range(a-b+1):
    cnt = 0
    c = s[i,i+t]
    for x, y in zip(c, t):
        if x != y:
            cnt +=1
    l.append(cnt)
print(min(l))

s=input()
t=input()
a = len(s)
b = len(t)
l = []
for i in range(a-b+1):
    cnt = 0
    c = s[i:i+b]
    for x, y in zip(c, t):
        if x != y:
            cnt +=1
    l.append(cnt)
print(min(l))

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 = len(S)
t = len(T)
ans1 = 10000000

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

S = input()
T = input()

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

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


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

cnt=0
ans=0

b=[0]*len(S)
a=[0]*len(S)
for i in range(len(S)):
    cnt = 0
    for j in range(len(T)):
        cnt = 0
        #print(S[i],T[j])
        if S[i]==T[j]:
            cnt+=1
            if j != len(T):
                for k in range(j+1,len(T)-j-2):
                    if S[i+k]==T[j+k]:
                        cnt+=1
                    else:
                        b[i]=cnt
                        break
            b[i]=cnt
            a[i]=j

for i in range(len(a)):
    if a[i]==a.index(a[i]):
        c = a.index(a[i])
        ans = b[c]
        break
        
print(len(T)-ans)

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)

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 = len(T)
for i in range(len(T)):
    for j in range(i+1,len(T)+1):
        if T[i:j] in S:
            if i - S.find(T[i:j]) <= 0 and len(T) - S.find(T[i:j]) - 1 >= len(T) - i - 1:
                ans = min(ans, len(T)-len(T[i:j]))
print(ans)

S = input()
T = input()

ans = float('INF')
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)

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

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)

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

for s_start in range(len(s)):
  if i + len(t) - 1 >= 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)

s = input()
t - input()

ans = len(s)

for s_start in range(len(s)):
  if i + len(t) - 1 >= 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)

s = input()
t = input()

ans = len(s)

for i in range(len(s)):
  if i + len(t) - 1 >= 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)

s = input()
t = input()

ans = len(s)

for i in range(len(s)):
  if i + len(t) - 1 >= 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: 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 = list(input().split())
s = len(S)
t = len(T)
list1 = [] 
list2 = []
n = 0


for i in range(n, s-t+1): 
    ss = S[n:t + n]
    n += 1
    m = 0
    for x in ss:
        
        if x == T[m]:
            list1.append(1)
            m +=1
        else:
            list1.append(0)
            m +=1
    
    list2.append(sum(list1))
    list1 = []
   
print(t - max(list2))

S, T = list(input().split())
s = len(S)
t = len(T)
list1 = [] 
list2 = []
n = 0


for i in range(n, s-t+1): 
    ss = S[n:t + n]
    n += 1
    m = 0
    for x in ss:
        
        if x == T[m]:
            list1.append(1)
            m +=1
        else:
            list1.append(0)
            m +=1
    
    print(list1)
    list2.append(sum(list1))
    list1 = []
   
print(t - max(list2))

#!/usr/bin/env python
# coding: utf-8

# In[48]:


S, T = list(input().split())
s = len(S)
t = len(T)
list1 = [] 
list2 = []
n = 0


for i in range(n, s-t+1): 
    ss = S[n:t + n]
    n += 1
    m = 0
    for x in ss:
        
        if x == T[m]:
            list1.append(1)
            m +=1
        else:
            list1.append(0)
            m +=1
    
    list2.append(sum(list1))
    list1 = []
   
print(t - max(list2))


# In[ ]:






S, T = list(input().split())
s = len(S)
t = len(T)
l1 = [] 
l2 = []
n = 0
for i in range(n, s-t+1): 
    ss = S[n:t + n]
    n += 1
    m = 0
    for x in ss:       
        if x == T[m]:
            l1.append(1)
            m +=1
        else:
            l1.append(0)
            m +=1   
    l2.append(sum(l1))
    l1 = []
print(t - max(l2))

#!/usr/bin/env python
# coding: utf-8

# In[55]:


S, T = list(input().split())
s = len(S)
t = len(T)
l1 = [] 
l2 = []
n = 0


for i in range(n, s-t+1): 
    ss = S[n:t + n]
    n += 1
    m = 0
    for x in ss:
        
        if x == T[m]:
            l1.append(1)
            m +=1
        else:
            l1.append(0)
            m +=1
    
    l2.append(sum(l1))
    l1 = []
    
print(t - max(l2))


# In[ ]:






S = input()
T = input()
s = len(S)
t = len(T)
l1 = [] 
l2 = []
n = 0
for i in range(n, s-t+1): 
    ss = S[n:t + n]
    n += 1
    m = 0
    for x in ss:       
        if x == T[m]:
            l1.append(1)
            m +=1
        elif x != T[m]:
            l1.append(0)
            m +=1   
    l2.append(sum(l1))
    l1 = [ ]
print(t - max(l2)) 

Verdicts: Runtime Error

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):
import numpy as np
from copy import deepcopy
from heapq import heappop, heappush
from bisect import bisect_left, bisect
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations

S = input()
T = input()

replaced = S.replace(T, '')
print(len(S) - len(replaced))

exit()


import numpy as np
from copy import deepcopy
from heapq import heappop, heappush
from bisect import bisect_left, bisect
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations

S = input()
T = input()

replaced = T.replace(S, '')
print(len(T) - len(replaced))

exit()


import numpy as np
from copy import deepcopy
from heapq import heappop, heappush
from bisect import bisect_left, bisect
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations

S = input()
T = input()

m = len(T)

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

    m = min(c, m)

print(m)
exit()


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):
def core(s, t):
  if t in s:
    return 0
  for i in range(1, len(t)):
    for j in range(i+1):
      temp = t[j:]
      if temp in s:
        return j
  return len(t)
  
if __name__ == "__main__":
  strings = [input() for i in range(2)]
  print(core(strings[0], strings[1]))


def subst(S, T)-> int:
  lenT = len(T)
  result = lenT
  for i in range(lenT, len(S) + 1):
    tempS = S[i-lenT:i]
    tempResult = 0
    for j in range(lenT):
      if T[j] != tempS[j]:
        tempResult += 1
    if tempResult < result:
      result = tempResult
    
  return result

if __name__ == "__main__":
  S = input()
  T = input()
  print(subst(S, T))

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()
maxs = 0
if len(s) == len(t):
    c = 0
    for k in range(len(t)):
        if s[k] == t[k]: c += 1
    print(len(t) - c)
    quit()
for i in range(len(s)-len(t)):
    c = 0
    for k in range(len(t)):
        if s[i+k] == t[k]: c += 1
    maxs = max(c,maxs)
print(maxs)
print(len(t) - maxs)

s = input()
t = input()
maxs = 0
if len(s) == len(t):
    c = 0
    for k in range(len(t)):
        if s[k] == t[k]: c += 1
    print(len(t) - c)
    quit()
for i in range(len(s)-len(t)):
    c = 0
    for k in range(len(t)):
        if s[i+k] == t[k]: c += 1
    maxs = max(c,maxs)
print(len(t) - maxs)

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 = 100000

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

print(Min)

 S = input()
T = input()

Min = 100000

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

print(count)

S = input()
T = input()

Min = 100000

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

print(count)

S = input()
T = input()

Min = 100000

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

print(Min)

Verdicts: Wrong Answer

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):
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import copy
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


def solve():
    S = Scanner.string()
    T = Scanner.string()
    ma = len(S) - len(T) + 1
    ans = len(T)
    for i in range(0, ma):
        cnt = 0
        for j in range(len(T)):
            if S[i + j] != T[j]:
                cnt += 1
        ans = min(ans, cnt)
    print(ans)


def main():
    
    sys.stdin = open("sample.txt")
    solve()


if __name__ == "__main__":
    main()


# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import copy
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


def solve():
    S = Scanner.string()
    T = Scanner.string()
    ma = len(S) - len(T) + 1
    ans = len(T)
    for i in range(0, ma):
        cnt = 0
        for j in range(len(T)):
            if S[i + j] != T[j]:
                cnt += 1
        ans = min(ans, cnt)
    print(ans)


def main():
    
    
    solve()


if __name__ == "__main__":
    main()


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

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


s = input()
t = input()

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


s = input()
t = input()

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


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 = [0]
            
#print(cnt)
print(len(t) - max(cnt))


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)
            #print(t[i:k], s[i:], k-i)
        else:
            cnt.append(0)
            
#print(cnt)
print(len(t) - max(cnt))


Verdicts: Runtime Error

Runtime Error

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

l = len(t)
flag = 0
for i in range(1, l+1):
    if flag == 1:
        break
    for j in range(i):
        if t[j:j+(l-i)+2] in s[j:len(s)-i+j]:
            flag = 1
            print(i-1)
            break

if flag == 0:
    print(l)

s = input()
t = input()

l = len(t)
same = 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
    if count > same:
        same = count

print(len(t) - same)

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

T_length = len(T)
max_count = 0

for i in range(len(S)-T_length+1):
  count = 0
  for j in range(T_length):
    if S[i:i + T_length][j] == T[j]:
      count += 1
  else:
    if max_count > count:
      max_count = count

print(T_length - max_count)


S = list(input())
T = list(input())

T_length = len(T)
max_count = 0

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

print(T_length - max_count)


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):
import sys


def resolve(in_):
    S = next(in_).strip()
    T = next(in_).strip()

    x = 0
    for i in range(len(S)):
        if len(S) - i < len(T):
            break
        v = 0
        for x, y in zip(S[i:], T)
            if x == y:
                v += 1
            x = max(x, len(T) - v)
    
    return x
    

def main():
    answer = resolve(sys.stdin)
    print(answer)


if __name__ == '__main__':
    main()


import sys


def resolve(in_):
    S = next(in_).strip()
    T = next(in_).strip()

    ans = 0
    for i in range(len(S)):
        if len(S) - i < len(T):
            break
        v = 0
        for x, y in zip(S[i:], T):
            if x == y:
                v += 1
            ans = max(ans, v)
    
    return len(T) - ans
    

def main():
    answer = resolve(sys.stdin)
    print(answer)


if __name__ == '__main__':
    main()


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()
list1 = list()
y = list()
for i in range(len(s)):
    if i < (len(s)-len(t)+1):
        list1.append(s[i:(i+len(t))])
print(list1)
for j in range(len(list1)):
    count = 0
    for k in range(len(t)):
        if list1[j][k] != t[k]:
            count = count + 1
    y.append(count)
print(min(y))


s = input()
t = input()
list1 = list()
y = list()
for i in range(len(s)):
    if i < (len(s)-len(t)+1):
        list1.append(s[i:(i+len(t))])
for j in range(len(list1)):
    count = 0
    for k in range(len(t)):
        if list1[j][k] != t[k]:
            count = count + 1
    y.append(count)
print(min(y))


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()
print(len(t)-min(sum(x!=y for x,y in zip(s[i:],t))for i in range(-~len(s)-len(t))))

s=input()
t=input()
print(min(sum(x!=y for x,y in zip(s[i:],t))for i in range(-~len(s)-len(t))))

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):
def matcher(s1,s2):
    match=0
    for i in range(len(s1)):
        if(s1[i]!=s2[i]):
            match+=1
            
    return match

s = input()
st = input()
mx=10**9

rangeforloop= len(s)+1 - len(st)

for i in range(rangeforloop):
    if(mx> matcher(s[i:len(st)],st)):
      mx=matcher(s[i:len(st)],st)

ans = mx  
print(ans)
    


s = input()
st = input()
mx=10**5

rangeforloop= len(s)+1 - len(st)
 
for i in range(rangeforloop):
    mx=min(mx,matcher(s[i:len(st)+i], st))
    
     
print(mx)

s = input()
st = input()
mx=10**9

rangeforloop= len(s)+1 - len(st)
 
for i in range(rangeforloop):
    mx=min(mx,matcher(s[i:len(st)+i], st))
    
     
print(mx)

from math import min
s = input()
st = input()
mx=10**5

rangeforloop= len(s)+1 - len(st)
 
for i in range(rangeforloop):
    mx=min(mx,matcher(s[i:len(st)+i], st))
    
     
print(mx)

s = input()
st = input()
mx=10**9

rangeforloop= len(s)+1 - len(st)
 
for i in range(rangeforloop):
    mx=min(mx,matcher(s[i:len(st)+i], st))
    
     
print(mx)

s = input()
st = input()
mx=10**9

rangeforloop= len(s)+1 - len(st)
 
for i in range(rangeforloop):
    mx=min(mx,matcher(s[i:len(st+i)], st))
    
     
print(mx)

def matcher(s1,s2):
    match=0
    for i in range(len(s1)):
        if(s1[i]!=s2[i]):
            match+=1
            
    return match



s = input()
st = input()
mx=0
 
rangeforloop= len(s)+1 - len(st)
 
for i in range(rangeforloop):
    if(mx < matcher(s[i:len(st)],st)):
      mx=matcher(s[i:len(st)],st)
 
 
print(mx)

def matcher(s1,s2):
    match=0
    for i in range(len(s1)):
        if(s1[i]!=s2[i]):
            match+=1
            
    return match

#print(matcher("eforces","atcoder"))

s = input()
st = input()
mx=10**5

rangeforloop= len(s)+1 - len(st)
 
for i in range(rangeforloop):
    mx=min(mx,matcher(s[i:len(st)+i], st))
    
     
print(mx)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

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,T=open(0).read().split()
def main():
    for i in range(1,len(T)+1):
        for j in range(i+1):
            print(T[j:(len(T)-i+j)], S[j:(len(S)-i+j)])
            if T[j:(len(T)-i+j)] in S[j:(len(S)-i+j)]:
                return i
                break
if T in S:
    print(0)
else:
    print(main())

S,T=open(0).read().split()
score = 0
for i in range(len(S)-len(T)+1):
    score=max(score,sum([T[k]==S[i+k] for k in range(len(T))]))
print(len(T)-score)

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

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

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

    print(l)
    if len(l) > 0:
        a = len(T) - max(l)
        print(a)
    else:
        a = 1
        print(a)


S = input()
T = input()

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

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

    # print(l)
    if len(l) > 0:
        a = len(T) - max(l)
        print(a)
    else:
        a = 1
        print(a)


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

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)

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

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

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

# 171 B
S = input()
T = input()
ans = []
for i in range(0, (len(S)-len(T) + 1)):
    tmp = 0
    #print(i)
    for j in range(0, len(T)):
        if T[j] != S[i +j]:
            tmp += 1
            print(S[i +j] + T[j])
        #print('tmp:' + str(tmp))
    ans.append(tmp)
        
print(min(ans))

# 171 B
S = input()
T = input()
ans = []
for i in range(0, (len(S)-len(T) + 1)):
    tmp = 0
    #print(i)
    for j in range(0, len(T)):
        if T[j] != S[i +j]:
            tmp += 1
            #print(S[i +j] + T[j])
        #print('tmp:' + str(tmp))
    ans.append(tmp)
        
print(min(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):
main = input()
word = input()
temp = main
resultArray = []
final = len(word)
for j in range(len(main) - (len(word) - 1)):
    result = ''
    for i in range(len(word)):
        if main[j + i] == word[i]:
            result += '1'
        else:
            result += '0'
    resultArray.append(result)
for i in resultArray:
    if i.count('0') < final:
        final = i.count('0')
print(resultArray)
print(final)


main = input()
word = input()
temp = main
resultArray = []
final = len(word)
for j in range(len(main) - (len(word) - 1)):
    result = ''
    for i in range(len(word)):
        if main[j + i] == word[i]:
            result += '1'
        else:
            result += '0'
    resultArray.append(result)
for i in resultArray:
    if i.count('0') < final:
        final = i.count('0')
print(final)


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):
import re
s=input()
t=input()
li=[]
cntli=[]
n=len(t)
for i in range(1,1<<n):
  wk=""
  cnt=0
  for j in range(n):
    if (i>>j) & 1 == 1:
      wk+=t[j]
    else:
      wk+="."
      cnt+=1
  li.append(wk)
  cntli.append(cnt)
ans=n
for i in range(len(li)):
  if re.search(li[i],s):
    ans=cntli[i]
    break
print(ans)


s=input()
t=input()
ans=len(t)
for i in range(len(s)-len(t)+1):
  cnt=len(t)
  for j in range(len(t)):
    if s[i+j]==t[j]:
      cnt-=1
  if cnt<ans:
    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):
import sys
from sys import stdin
input = stdin.readline

INF = 10**9

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

import sys
from sys import stdin
input = stdin.readline

INF = 10**9

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

# import sys
# from sys import stdin
# input = stdin.readline

INF = 10**9

s = input()
t = input()
ans = 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
  ans = min(ans, cnt)
print(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()
T = input()

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

S = input()
T = input()

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

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

print(len(t)-ans)

s = input()
t = input()

def count_ans(a,b):
    ans = 0
    for c1,c2 in zip(a, b):
        if c1 == c2:
            ans += 1
    return ans

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

print(len(t)-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 l in reversed(range(len(T))):
    length = l + 1
    #print(length)
    for start in range(len(T) - l):
        #print(T[start:start + length])
        if T[start:start + length] in S[start:start + length]:
            print(len(T) - length)
            #print(T[start:start + length])
            #print(S[start:])
            break
        elif l == 0 and start == len(T) - length and T[start:start + length] not in S[start:]:
            print(len(T))
            break
    else:
        continue
    break

S = input()
T = input()

ans = len(T)

for S_start in range(len(S) - len(T) + 1):
    correct = 0
    for i in range(len(T)):
        if T[i] != S[S_start + i]:
            correct += 1
    ans = min(ans, correct)
    #print(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()

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

S = input()
T = input()

max_cnt = 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
    max_cnt = max(max_cnt, cnt)
print(len(T) - max_cnt)

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, T = input().split("\n")

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

			

S = input()
T = input()

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

print(cnt)

			

S, T = input().split("\n")

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

			


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

			

Verdicts: 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 = input()
T = input()

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

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

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=len(t)
for i in range(len(s)-len(t)+1):
	p=s[i:i+len(t)]
	cur = 0
	for j in range(len(t)):
		if t[j] != t[i + j]:
			cur += 1	
	ans=max(ans,cur)
print(ans)


s=input()
t=input()
ans=len(t)
for i in range(len(s)-len(t)+1):
	p=s[i:i+len(t)]
	cur = 0
	for j in range(len(t)):
		if t[j] != p[j]:
			cur += 1
	ans=min(ans,cur)
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=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))

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

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()
i,m=0,1e9
while(i<len(s)):
    c=0
    if(i+len(t)<len(s)):
        for j in range(len(t)):
            if(s[i]!=t[j]):
                c+=1
            i+=1 
    else:
        break
    m=min(m,c)
print(m)       
    

s=input()
t=input()
i,m=0,1e9
while(i+len(t)<=len(s)):
    c=0
    for j in range(len(t)):
        if(s[i+j]!=t[j]):
            c+=1
    m=min(m,c)
    i+=1
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
for i in range(s-t+1):
    cnt = 0
    for j in range(len(t)):
        if s[i+j] == t[j]:
            cnt += 1
    ans = max(ans,cnt)

print(len(t)-ans)


s = input()
t = input()

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

print(len(t)-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 = len(t)
for i in range(len(s)-len(t)+1):
	diff = 0
	for j in range(len(t)):
		if not s[i+j] == t[j]:
			diff=diff+1
	print(diff)
	ans = min(ans, diff)
print(ans)

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 not s[i+j] == t[j]:
			diff=diff+1
	ans = min(ans, diff)
print(ans)

Verdicts: Wrong Answer

Accepted