Problem:


Score : 200 points

Problem Statement

Given are two strings S and T.

Let us change some of the characters in S so that T will be a substring of S.

At least how many characters do we need to change?

Here, a substring is a consecutive subsequence. For example, xxx is a substring of yxxxy, but not a substring of xxyxx.

Constraints

The lengths of S and T are each at least 1 and at most 1000.

The length of T is at most that of S.

S and T consist of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S
T

Output

Print the minimum number of characters in S that need to be changed.

Sample Input 1

cabacc
abc

Sample Output 1

1

For example, changing the fourth character a in S to c will match the second through fourth characters in S to T.

Since S itself does not have T as its substring, this number of changes - one - is the minimum needed.

Sample Input 2

codeforces
atcoder

Sample Output 2

6



Sample input:
cabacc
abc


Sample output:
1

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s = input("")
t = input("")
k = 0

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

print(len(t)-k)

Submission status: Wrong Answer

Solution code:
s = input("")
t = input("")
k = 0

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

print(len(t)-k)

Submission status: Wrong Answer

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

ans = 10000

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

Submission status: Wrong Answer

Solution code:
s = input()
t = 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
    # print(count)
    ans = min(ans, count)

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
#import numpy as np
import math
#sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    lent = len(t)
    for i in range(lent,-1,-1):
        for j in range(lent-i+1):
            if lent<=i+j:    break
            if t[j:i+j] in s[j:]:
                return lent-i
    return lent

if __name__=='__main__':
    s = S()
    t = S()
    print(solve())

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
#import numpy as np
import math
#sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    lent = len(t)
    for i in range(lent,-1,-1):
        for j in range(lent-i+1):
            if lent<i+j:    break
            if t[j:i+j] in s[j:]:
                return lent-i
    return lent

if __name__=='__main__':
    s = S()
    t = S()
    print(solve())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

res = 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
  res = max(res,count)

print(len(t)- count)

Submission status: Wrong Answer

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


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

print(len(t)- count)

Submission status: Wrong Answer

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

l = len(t)
n = len(s) - len(t)

def count_diffs(lhs, rhs):
    return len(list(filter(lambda t: t[0] != t[1], zip(lhs, rhs))))

min_diff = l

for i in range(n):
    diff = count_diffs(s[i : i + l], t)

    if diff < min_diff:
        min_diff = diff

print(min_diff)

Submission status: Wrong Answer

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

l = len(t)
n = len(s) - len(t)

def count_diffs(lhs, rhs):
    return len(list(filter(lambda t: t[0] != t[1], zip(lhs, rhs))))

min_diff = 1000

for i in range(n):
    diff = count_diffs(s[i : i + l], t)

    if diff < min_diff:
        min_diff = diff

print(min_diff)

Submission status: Wrong Answer

Solution code:
match_cnt = 0

S = input()
T = input()

S_len = len(S)
T_len = len(T)

for S_idx in range(S_len - T_len):
  cnt = 0

  for T_idx in range(T_len):
    if(S[S_idx + T_idx] == T[T_idx]):
      cnt += 1
  
  if( cnt > match_cnt ):
    match_cnt = cnt

  
print(T_len - match_cnt)

Submission status: Wrong Answer

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

T_len = len(T)

for num in range(T_len):
  strTemp = T[:(T_len - num)]
  
  if( S.count(strTemp) != 0 ):
    break

print(num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from re import search

S = input()
T = input()
l = len(T)

if T in S:
  print(0)
else:
  for i in range(1, l):
    for j in range(l - i + 1):
      t = T[:j] + '.' * i + T[i+j:]
      if search(t, S) != None:
        print(i)
        break
    else:
      continue
    break
  else:
    print(l)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
maxs = 0
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)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

S = input()
T = input()
lenS = len(S)
lenT = len(T)

samemax = 0
for si in range(lenS - lenT + 1):
    cntmax = 0
    cnt = 0
    cont = True
    for s, t in zip(S[si:], T):
        if s == t:
            if cont:
                cnt += 1
            else:
                cnt = 1
                cont = True
        else:
            cnt = 0
            cont = False
        cntmax = max(cntmax, cnt)
    samemax = max(cntmax, samemax)

print(lenT - samemax)

Submission status: Wrong Answer

Solution code:
# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

S = input()
T = input()

if T in S:
    print(0)
    exit()
for num in range(1, len(T)):
    par1 = T[num:]
    if par1 in S[num:]:
        print(num)
        exit()
    par2 = T[:-num]
    if par2 in S[:-num]:
        print(num)
        exit()
print(len(T))

Submission status: Wrong Answer

Solution code:
# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

S = input()
T = input()

if T in S:
    print(0)
    exit()
for num in range(1, len(T)):
    par1 = T[num:]
    if par1 in S:
        print(num)
        exit()
    par2 = T[:-num]
    if par2 in S:
        print(num)
        exit()
print(len(T))

Submission status: Wrong Answer

Solution code:
S=list(input())                                                                                                                                        
T=list(input())                                                                                                                                        
                                                                                                                                                       
T_size = len(T)                                                                                                                                        
                                                                                                                                                       
def match_num(x):                                                                                                                                      
    return T_size - sum([1 for a,t in zip(x, T) if a==t])                                                                                              
                                                                                                                                                       
b=[]                                                                                                                                                   
for i in range(len(S)):                                                                                                                                
    b.append(match_num(S[i:i+T_size]))                                                                                                                 
                                                                                                                                                       
print(min(b))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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)]
        print(temp)
        cnt = cnt+len(T)
    else:
        break
    
    
print(result)

Submission status: Wrong Answer

Solution code:
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*2 <= len(S):
        temp = S[cnt:cnt*2]
        cnt = cnt*2
    else:
        break
    
    
print(result)

Submission status: Wrong Answer

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

ans = len(t)

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
ans=0
tsize=len(t)
for i in range(tsize):
        if t[:i] in s:
            ans=tsize-(i+1)
            
print(ans)

Submission status: Wrong Answer

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

max_match = 0

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

for i in range(m-n):
    tmp = 0
    for j in range(i,i+n):
        if S[j] == T[j-i]:
            tmp += 1
    if tmp > max_match:
        max_match = tmp

ans = n - max_match



print(ans)

Submission status: Wrong Answer

Solution code:
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)

if best == float("inf"):
  print(0)
else:
  print(best)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
s, t = input(), input()
b = 1000
for i in range(len(s) - len(t) + 1):
    a = 0
    for j in range(len(t)):
        if s[i + j] != t[j]:
            a += 1
    a = min(a, b)
print(a)

Submission status: Wrong Answer

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

iteration = len(S) - len(T) + 1

if T in S:
    ans = 0
else:
    minimum = len(T)
    for i in range(iteration):
        s = S[i:len(T)+i]
        for j in range(len(T)):
            count = 0
            if s[j] != T[j]:
                count += 1
        minimum = min(minimum, count)
    ans = minimum
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
l = len(s)
m = len(t)
maxi = 0
for i in range(l-m-1):
    t1 = s[i:i+m]
    x = 0
    for j in range(m):
        if t1[j] == t[j]:
            x = x + 1
    if maxi < x:
        maxi = x

mini = m - maxi

print(mini)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

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

res = len(T)

for i in range(len(S) - len(T) + 1):
    cnt = 0
    smallS = S[i:len(T)+1]
    for s, t in zip(smallS, T):
        if s == t:
            cnt += 1
    if (len(T) - cnt) < res:
        res = len(T) - cnt    

print(res)

Submission status: Wrong Answer

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

res = float('inf')

for i in range(len(S) - len(T) + 1):
    cnt = 0
    smallS = S[i:len(T)+1]
    for s, t in zip(smallS, T):
        if s == t:
            cnt += 1
    if (len(T) - cnt) < res:
        res = len(T) - cnt    

if res > len(T):
    print(len(T))
else:
    print(res)

Submission status: Wrong Answer

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

res = float('inf')

for i in range(len(S)-len(T)):
    cnt = 0
    smallS = S[i:len(T)+1]
    for s, t in zip(smallS, T):
        if s == t:
            cnt += 1
    if (len(T) - cnt) < res:
        res = len(T) - cnt    

if res > len(T):
    print(len(T))
else:
    print(res)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    S = input()
    T = input()

    #TがSの部分文字列になるようにSを書き換える

    N = len(S)
    M = len(T)
    L = N - M #Sを調べるループの回数
    #二重ループが許される
    ans = M
    for i in range(L): 
        #最大M個一致していない。
        cnt = M
        for j in range(M):
            if S[i+j] == T[j]: 
                cnt -= 1
        #最小を取る
        ans = min(ans, cnt)
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

min = 100000
for i in range(len(S)) :
    for j in range(len(S),i-1,-1) :
        if (S[i:j] in T) :
            if (min > len(T) - len(S[i:j])) and (i >= T.index(S[i:j])) :
                min = len(T) - len(S[i:j])

print(min)

Submission status: Wrong Answer

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

ans = 1000
sub = 0
for i in range(len(s)):
    if s[i] != t[sub]:
        sub = 0
        continue
    else:
        if sub == len(t) - 1:
            print(0)
            exit()
        sub += 1

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

print(ans)

Submission status: Wrong Answer

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

T1= T
Tlist =[]
countfront = 0
countback = 0
while T not in S:
  #if T not in S:
    #print (T,S)
  Tlist = list(T)
  Tlist.pop(0)
  T ="".join(Tlist)
  T.lstrip()
  #print (T)
  countfront+=1

Tlist = []
while T1 not in S:
  #if T1 not in S:
    #print (T1,S)
  Tlist = list(T1)
  Tlist.pop(0)
  T1 ="".join(Tlist)
  T1.lstrip()
  #print (T1)
  countback+=1
  
if countfront>countback:
  print (countback)
else :
  print (countfront)

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
diff = len(S)-len(T)

count, best = 0, 0

for i in range(diff+1):
  
  s = S[i:len(T)+i]
  
  #print('s')
  #print(s)
  
  count = 0
  for j,k in zip(s,T):
    if j == k:
      count += 1
    if count > best:
      best = count

print(len(T)-count)

Submission status: Wrong Answer

Solution code:
def count_diff(a,b):
    cnt = 0
    for c1,c2 in zip(a, b):
        if c1 != c2:
            cnt += 1
    return cnt

S = str(input())
T = str(input())
mn = 100

for i in range(len(S)-len(T)+1):
    s = S[i:i+len(T)]
    x = count_diff(s,T)
    mn = min(mn,x)

print(mn)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#検索される文字列
S = input()
#検索する文字列
T = input()
min = len(T)


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

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
lenS=len(S)
lenT=len(T)
count=[]

for i in range(lenS-lenT+1):
    c=0
    for j in range(lenT):
        if T[j]!=S[i+j]:
            c=c+1
        j=j+1
        print(c)
    count.append(c)
    i=i+1
print(min(count))

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
m=len(t)
for i in range(len(s)-len(t)):
    ma=len(t)
    for j in range(len(t)):
        if s[i+j]==t[j]:
            ma-=1
    if ma <m:
        m=ma
print(m)

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
m=len(t)
for i in range(len(s)-len(t)):
    ma=0
    for j in range(len(t)):
        if s[i+j]!=t[j]:
            ma+=1
    if ma <m:
        m=ma
print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(len(t)-count)

Submission status: Wrong Answer

Solution code:
S = input()
subS = input()
max_common = 0
for idx in range(len(S)):
    curr_idx = idx
    sub_idx = 0
    curr_max = 0
    while(sub_idx < len(subS) and curr_idx < len(S)):
        if(subS[sub_idx] == S[curr_idx]):
            curr_max += 1
        sub_idx += 1
        curr_idx += 1
    if(curr_max > max_common):
        max_common = curr_max
print(len(subS) - max_common)

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
t = input()
m = len(t)
c_max = 0
for i in range(n - m):
    c = 0
    for j in range(m):
        if s[i + j] == t[j]:
            c += 1
    if c > c_max:
        c_max = c
print(m - c_max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
t = input()
neq = len(t)
for i in range(len(S)-len(t)+1):
  if S[i]==t[0]:
    neq_temp = 0
    for j in range(1,len(t)):
      if S[i+j]!=t[j]:
        neq += 1
    neq = min(neq,neq_temp)
print(neq)

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
ls = len(S)
lt = len(T)
ans = lt
for i in range(ls):
    temp = 0
    if i+lt >= ls:
        break
    subS = S[i:i+lt]
    for ss, st in zip(subS, T):
        if ss != st:
            temp += 1
    ans = min(ans, temp)
print(ans)

Submission status: Wrong Answer

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

    mn = 10**5
    for i in range(len(s)-len(t)):
        result = 0
        for j in range(len(t)):
            if s[i+j] != t[j]:
                result += 1
        mn = min(result, mn)
    print(mn)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ls = len(s)
lt = len(t)
ret = ls
for i in range(ls - lt):
  diff = 0
  for j in range(lt):
    diff += (t[j] != s[i+j])
  if diff < ret:
    ret = diff
print(ret)

Submission status: Wrong Answer

Solution code:
import sys

s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()
n = len(t)

ret = len(s)
for i in range(len(s) - n):
    s2 = s[i:(i + n)]
    c = 0
    for j in range(n):
        if s2[j] != t[j]:
            c += 1
    if c < ret:
        ret = c
print(ret)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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

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

main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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

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

main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

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

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

main()

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline



S = input()
T = input()

S = S.replace('\n','')
T = T.replace('\n','')

s_list = list(S)
t_list = list(T)

itti = 0
max_itti = 0
for s in s_list:
    if max_itti == len(t_list):
        break
    if s == t_list[itti]:
        itti += 1
        max_itti = max(max_itti,itti)
    else:
        itti = 0
flag = False

if max_itti == 0:
    for s in s_list:
        for t in t_list:
            if s == t:
                max_itti = 1
                flag = True
            if flag:
                break
        if flag:
            break
                

print(len(t_list) - max_itti)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

lens = len(S)
lent = len(T)

ans = lent

for i in range(lens - lent):
  count = 0
  for j in range(lent):
    if S[i+j] != T[j]:
      count = count + 1

  if count < ans:
    ans = count
    
print(ans)

Submission status: Wrong Answer

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

lens = len(S)
lent = len(T)

ans = lent

for i in range(lens - lent):
  count = 0
  for j in range(lent):
    if S[i+j] != T[j]:
      count = count + 1

  if count < ans:
    ans = count
    
print(ans)

Submission status: Wrong Answer

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

print(S)
print(T)

lens = len(S)
lent = len(T)

ans = 1000000

for i in range(lens - lent):
  count = 0
  for j in range(lent):
    if(S[i+j] != T[j]):
      count = count + 1

  if count < ans:
    ans = count
    
print(ans)

Submission status: Wrong Answer

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

print(S)
print(T)

lens = len(S)
lent = len(T)

ans = 1000000

for i in range(lens - lent):
  count = 0
  for j in range(lent):
    if(S[i+j] != T[j]):
      count = count + 1

  if count < ans:
    ans = count
    
print(ans)

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
a = []
for i in list(s):
    a.append(i)
b = []
for j in list(t):
    b.append(j)
c = len(a)
d = len(b)
w = 1000
for k in range(c-d):
    e = a[k:k+d]
    f = 0
    for l in range(d):
        if e[l] != b[l]:
            f= f+1
    if w > f:
         w= f
print(w)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
cnt = 0
ans = 0
while cnt < len(s) - len(t):
    chk = 0
    for i, j in zip(range(cnt,cnt+len(t)),range(len(t))):
        if s[i] == t[j]:
            chk += 1
    ans = max(ans,chk)
    cnt += 1

print(len(t) - ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

answer = 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 = count + 1
	if count < answer:
		answer = count
print(count)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
lens = len(S)
lent = len(T)

ans = -1
for i in range(lens-lent+1):
    S2 = S[i:i+lent]
    diff = 0
    for j in range(lent):
        if S2[j] != T[j]:
            diff += 1
    if ans == -1:
        ans = diff
    else:
        if ans > diff:
            ans = diff
print(diff)

Submission status: Wrong Answer

Solution code:
S, T = [input() for i in range(2)]
ans = float("inf")
for start in range(len(S) - len(T)):
    diff = 0
    for t, s in zip(T, S[start:]):
        if t != s:
            diff += 1
    ans = min(ans, diff)
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
t_len = len(T)
count = len(S) - len(T) + 1
max_correct = []
for i in range(count):
  s_tmp = S[i:t_len]
  for n, s in enumerate(s_tmp):
    correct = 0
    if s == T[n]:
      correct += 1
    max_correct.append(correct)
  i = i + 1
  t_len = t_len + 1

print(max(max_correct))

Submission status: Wrong Answer

Solution code:
"""B."""

import sys

input = sys.stdin.readline  # noqa: A001

S = input()[:-1]
T = input()[:-1]


def is_replace(a: str, b: str, n: int) -> bool:
    total = 0
    for c1, c2 in zip(a, b):
        if c1 == c2:
            total += 1
    return total + n == len(a)


patterns = {S[i:len(T) + i] for i in range(len(S) - len(T))}
# print(patterns)
for i in range(len(T)):
    for pattern in patterns:
        if is_replace(pattern, T, i):
            print(i)
            exit(0)

print(len(T))

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

# S = "cabacc"
# T = "abc"

lt = len(T)

def diff(s1, s2):
    d = len(s1)

    d -= len([i for i,j in zip(s1, s2) if i == j])
    return d

dlen = 1000000000
for i in range(len(S)):
    dlen = min(dlen, diff(T, S[i:i+lt]))

print(dlen)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
for i in range(len(S) - len(T)+1):
    largest = -1
    count = 0
    for j in range(len(T)):
        if S[i+j] == T[j]:
            count += 1
    if largest < count:
        largest = count
print(len(T) - largest)