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()
ans = 0
if T == S:
    print(ans)
else:
    for i in range(1,len(T)):
        ans+=1
        if T[i:] in S or T[:-i] in S:
            break
        
    print(ans)

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
n=len(t)
m=len(s)
for i in range(n):
    l=n-i
    for j in range(i+1):
        if ''.join(t[j:j+l]) in ''.join(s[j:j+m-i]):
            print(i)
            exit()
print(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
ss = str(input())
tt = str(input())
#print(ss,tt)
maxmatch = 0
#
for i in range(len(ss)-len(tt)):
    nofmatch = 0
    for j in range(len(tt)):
        if ss[i+j] == tt[j]:
            nofmatch += 1
    if nofmatch > maxmatch:
        maxmatch = nofmatch

print(len(tt)-maxmatch)

Submission status: Wrong Answer

Solution code:
#
# 177B
#
import sys

s = input()
t = input()

i = 0
tl = t
while i<len(t):
    if t[0:(len(t)-i)] in s:
        tl = t[0:(len(t)-i)]
        #print(tl)
        break
    i += 1

l = len(t)-len(tl)

#print("==================")

i = 0
tr = t
#print("start tr:"+tr)
while i<len(t):
    if t[i:len(t)] in s:
        tr = t[i:(len(t))]
        #print("i:"+str(i)+"  tr:"+tr)
        break
    i += 1
#print("result tr:"+tr)

r = len(t)-len(tr)

#print("l:"+str(l))
#print("r:"+str(r))

if l==0:
    print(r)
    sys.exit()
elif r==0:
    print(l)
    sys.exit()

if l>r :
    print(str(r))
else:
    print(str(l))

Submission status: Wrong Answer

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

for i in range(len(t)+1):
	if t[0:len(t)-i] in s or t[i:len(t)] in s:
		break

j = 1

for j in range(1, int(len(t)/2)):
	if t[j:len(t)-j] in s:
		break

if i < j*2:
	print(i)
else:
	print(j*2)

Submission status: Wrong Answer

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

for i in range(len(s)-len(t)+1):
  a=s[i:len(t)+i]
  num=0
  for i,j in zip(t,a):
    if i!=j:
      num+=1
  num=min(1000,num)

print(num)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
def longestSubstringFinder(string1, string2):
    answer = ""
    len1, len2 = len(string1), len(string2)
    for i in range(len1):
        match = ""
        for j in range(len2):
            if (i + j < len1 and string1[i + j] == string2[j]):
                match += string2[j]
            else:
                if (len(match) > len(answer)): answer = match
                match = ""
    return answer

print(len(T) - len(longestSubstringFinder(S,T)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

s = input()
t = input()

max = 0
for i in range(0, len(s)):
    for j in range(i + 1, len(s) + 1):
        idx = t.find(s[i:j])
        if idx != -1 and idx <= i and len(t) - (idx + (j - i)) <= len(s) - j:
            if j - i > max:
                # print(max, ' ', i, ' ', j, ' ', s[i:j])
                max = j - i


print(len(t) - max)

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
min_c = len(T)
def diff(s,t):
    count = 0
    #print(s,t)
    for i in range(len(t)):
        if s[i]!=t[i]:
            count+=1
    #print(count)
    return count


for i in range(len(S)-len(T)):
    d = diff(S[i:],T)
    #print(d)
    if d<min_c:
        min_c = d
print(min_c)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
pos = True
for i in range(len(t)):
    if t[:len(t) - i] in s:
        print(i)
        pos = False
        break
if pos: print(len(t) - 1)

Submission status: Wrong Answer

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

t_list = []
for i in range(len(T)):
    for j in range(i, len(T)):
        t_list.append(T[i:j+1])
t_list.sort(key=len, reverse=True)
# print(t_list)

flg = True
for t in t_list:
    if S.find(t) != -1:
        S_find_t = S.find(t)
        T_find_t = T.find(t)
#         print(f't: {t}\n, S_find_t: {S_find_t}\n, T_find_t: {T_find_t}\n')
        n_front = S_find_t - T_find_t
        n_back = len(S) - n_front
        
        if (S_find_t >= T_find_t) & (len(T) - T_find_t - len(t) <= len(S) - S_find_t - len(t)):
#             print("Answer: ", end='')
            print(len(T) - len(t))
            flg = False
            break

if flg:
    print(len(T))

Submission status: Wrong Answer

Solution code:
a = input()
b = input()

l = []
for i in range(len(a)):
    cnt = 0
    for j in range(len(b)):
        if i + j < len(a) and b[j] == a[i + j]:
            cnt += 1
    l.append(cnt)

#print(l)
print(len(b) - max(l))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def main():
    min_num = len(T)
    for i in range(len(S)):
        count = 0
        for j in range(len(T)):
            try:
                if S[i+j] == T[j]:
                    count += 1
            except:
                break
        min_num = min_num if min_num < len(T)-count else len(T)-count
    print(min_num)

S = input()
T = input()
main()

Submission status: Wrong Answer

Solution code:
sList = list(input())
tList = list(input())
numList = []
 
for ti,t in enumerate(tList):
  num = 0
  for si,s in enumerate(sList):
    tnum = ti
    snum = si
    while tList[tnum] == sList[snum]:
      num += 1
      tnum += 1
      snum += 1
      if tnum >= len(tList): break
      if snum >= len(sList): break
  numList.append(num)
  if max(numList) > (len(sList) - ti): break

if len(tList) - max(numList) > 0:
  print(len(tList) - max(numList))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
s_len = len(s)
t_len = len(t)

max_c = 0
for i in range(s_len - t_len):
    count = 0
    for j in range(t_len):
        if s[i+j] == t[j]:
            count+=1
    if count == t_len:
        print(0)
        exit()
    if count > max_c:
        max_c = count
print(t_len-max_c)

Submission status: Wrong Answer

Solution code:
def resolve():
    s = input()
    t = input()
    ans = 0

    for i in range(len(t)):
        for j in range(i, len(t)):
            test = t[i:j + 1]

            if test in s[i:len(s) - (len(t) - j)-1]:
                ans = max(ans, len(test))

    print(len(t) - ans)

resolve()

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == '__main__':
    S = sys.stdin.readline()
    T = sys.stdin.readline()
    max_match = -1
    for i in range(len(T)):
        for j in range(i+1, len(T)):
            pos = S[i:-j].find(T[i:j])
            # pos = S[i-(len(T)-j)].find(T[i:j])
            if max_match < j-i and pos != -1:
                max_match = j - i
    if max_match == -1:
        print(len(T))
    else:
        print(len(T)-max_match-1)

Submission status: Wrong Answer

Solution code:
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[i:len(S) - len(T[j:])]:
            if len(T) - len(T[i:j]) < ans:
                ans = len(T) - len(T[i:j])

print(ans)

Submission status: Wrong Answer

Solution code:
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:len(S) - (len(T) - (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:len(S) - (len(T) - (start + length))]:
            print(len(T))
            break
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
from itertools import combinations
from functools import reduce

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

res = [s[x:y] for x, y in combinations(
    range(len(s) + 1), r=2) if len(s[x:y]) == 3]

ans = []
for i in res:
    ans.append(reduce(lambda x, y: x + 1 if y[0] != y[1] else x, zip(i, t), 0))

print(min(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ans = [0]*len(s)
for i in range(len(s)):
    ans[i] = [0]*len(t)
i_his = 0
i = 0
j = 0
maxans = -1
while (i < len(s)):
    count = 0
    # print(i,j)
    while (j < len(t)):
        if(s[i] == t[j]):
            ans[i_his][j] += 1
            count += 1
        maxans = max(count,maxans)
        if(count == maxans):
            max_ind = i_his
        i += 1
        j += 1
        if(i >= len(s)):
            break
    j = 0
    i_his += 1
    i = i_his

print(len(t)-sum(ans[max_ind]))

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
A = len(T)
for i in range(len(T)):
    M = S.find(T[i:])
    if M >= i and A > i:
        A = i
    M = S.rfind(T[i:])
    if M >= i and A > i:
        A = i
for i in range(1,len(T)):
    M = S.find(T[:i])
    if M >= i and A > i:
        A = i    
    M = S.rfind(T[:i])
    if M >= i and A > i:
        A = i
print(A)

Submission status: Wrong Answer

Solution code:
import re
S = input()
T = input()
l = len(T)
ans = l
for i in range(l):
  for j in range(l):
    if (i<=j):
      if T[i:j+1] in S:
        for m in re.finditer(T[i:j+1],S):
          if m is not None:
            ff = m.span()
            if ff[0] >= i and ff[0] + (l-j) <= len(S):
              ans = min(ans, l - (j+1-i))
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
s = len(S)
t = len(T)
M = 0
tmp = [ord(char) - 96 for char in T]
for n in range(s-t+1):
  m = [ord(char) - 96 - tmp[i] for i, char in enumerate(S[n:n+t])].count(0)
  if M < m:
    M = m
print(t-m)

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
array = [0. for i in range(len(S))]
count = 0

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

Submission status: Wrong Answer

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

sl=[]
tl=[]

for i in range(len(s)):
  sl.append(s[i])
for i in range(len(t)):
  tl.append(t[i])
  
m=100000
for i in range(len(s)-len(t)):
  cnt=0
  for j in range(len(t)):
    if t[j]!=s[i+j]:
      cnt+=1
  m=min(m,cnt)
print(m)

Submission status: Wrong Answer

Solution code:
date0=input()
date1=input()
list=[]
if len(date1)>len(date0)-len(date1):
    N=len(date0)-len(date1)
else:
    N=len(date1)
for i in range(N):
    if date1[i] in date0[i:]:
        j=0
        result=1
        for j in range(len(date1)-i-1):
            if date1[i:j+i+2] in date0[i:]:
                result += 1
            else:
                break
        list.append(result)
list=sorted(list)
if list==[]:
    print(0)
else:
    print(len(date1)-list[-1])

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == '__main__':
    S = sys.stdin.readline()
    T = sys.stdin.readline()
    max_match = -1
    for i in range(len(T)):
        for j in range(i+1, len(T)):
            # pos = S[i:-j].find(T[i:j])
            pos = S[i-(len(T)-j)].find(T[i:j])
            if max_match < j-i and pos != -1:
                max_match = j - i
    if max_match == -1:
        l = len(T)
    print(len(T)-max_match-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
#a = list(map(int,input().split()))
m = 1000

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
x = len(t)
mx= 0

res= 0
for i in range(len(s) - x+1):
    print(i)
    tmp = s[i:i+x]
    cntmp = 0
    for j in range(x):
        if t[j] == tmp[j]:
            cntmp += 1
    # print(tmp, i)
    res = max(res, cntmp)
print(x-res)

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == '__main__':
    S = sys.stdin.readline()
    T = sys.stdin.readline()
    max_match = -1
    for i in range(len(T)):
        for j in range(i+1, len(T)):
            # pos = S[i:-j].find(T[i:j])
            pos = S[i:].find(T[i:j])
            if max_match < j-i and pos != -1:
                max_match = j - i
    if max_match == -1:
        l = len(T)
    print(len(T)-max_match-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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 if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()

Submission status: Wrong Answer

Solution code:
def judge(s,t):
  if t in s:
    return 0
  for i in reversed(range(len(t))):
    for j in range((len(t)-i)+1):
      if t[0+j:i+j] in s:
        if s.find(t[0+j:i+j])>=j:
          if len(s)-(s.find(t[0+j:i+j])+i)>=len(t)-(i+j):
            print(t[0+j:i+j])
            return len(t)-i

s = input()
t = input()

r = judge(s,t)
print(r)

Submission status: Wrong Answer

Solution code:
str = input()
part = input()

flg = False

for i in range(len(part)):
  for j in range(i + 1):
    target = str[j: len(str) - (i - j)]
    search = part[j: len(part) - (i - j)]
    # print(f'target {target}, search {search}')
    if search in target:
      print(i)
      flg = True
      break
  
  if flg:
    break

if not flg:
	print(len(part))

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
cnt = 0
min = 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 min < cnt:
        min = cnt
print(len(t)-min)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
flg = False
for i in range(len(T)):
	for j in range(i+1):
		tmpS = S[j:]
		if -i+j < 0:
			tmpS = tmpS[:-i+j]
		if T[j:len(T)-i+j] in tmpS:
			flg = True
			print(i)
			break
	if flg:
		break

Submission status: Wrong Answer

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


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


print(len(t)-ans)

Submission status: Wrong Answer

Solution code:
a=input()
b=input()
a=[str(c) for c in a]
b=[str(d) for d in b]
cnt=0
for v in range(len(b)):
  if a[v]==b[v]:
    cnt+=1
print(len(b)-cnt)

Submission status: Wrong Answer

Solution code:
import sys

s = input()
t = input()

unmatch=10000

for i in range(len(t)):

  for j in range(i,len(s)-(len(t)-i-1)):

    if t[i] == s[j]:
      buf=i
      for l in range(len(t)-i-1):
        if t[i+l+1] != s[j+l+1]:
          buf+=1
      if buf == 0:
        print(buf)
        sys.exit()
      else:
        if buf < unmatch:
          unmatch=buf
print(unmatch)

Submission status: Wrong Answer

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

    if T in S:
        print(0)

    maxdiff = 0
    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 > maxdiff):
                maxdiff = count
    print(maxdiff)


def main():
    probB()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
s = input()
t = input()
n = len(t)
no_change = 0
for size in range(n-1,-1,-1):
  for t_range in range(n-size):
    bubun = t[t_range:t_range+size+1]
    for s_range in range(t_range,len(s)-size):
      if bubun == s[s_range:s_range+size+1]:
        no_change = size
        break
    if no_change != 0:
      break
  if no_change != 0:
    break

print(n-no_change-1)

Submission status: Wrong Answer

Solution code:

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 if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()

Submission status: Wrong Answer

Solution code:
S = str(input())
T = str(input())
fg = 0
for i in range(len(T) , 0,-1):
    if T[0:i] in S:
        print(len(T)-i)
        fg = 1
        break
if fg == 0:
    for j in T:
        if j in S:
            print(len(T)-1)
            break

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
A = len(T)
for i in range(len(T)):
    M = S.find(T[i:])
    if M >= i and A > i:
        A = i
for i in range(1,len(T)):
    M = S.rfind(T[:i])
    if M >= i and A > i:
        A = i
print(A)

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
sizeT = len(T)
sizeS = len(S)
count = 0
tmp = 0
for i in range(sizeT):
    # print("あ")
    # print(S.index(T[i]))
    for j in range(i,sizeS):
        tmp = 0
        for k in range(sizeT-i):
            # print(tmp)  
            if j+k < sizeS:
                if T[i+k]==S[j+k]:
                    tmp += 1
                    # print(tmp)
                else:
                    k = sizeT-i
        if tmp > count:
            count = tmp

print(sizeT-count)

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == '__main__':
    S = sys.stdin.readline()
    T = sys.stdin.readline()
    max_match = -1
    for i in range(len(T)):
        for j in range(i+1, len(T)):
            pos = S[i:-j].find(T[i:j])
            if max_match < j-i and pos != -1:
                max_match = j - i
    if max_match == -1:
        l = len(T)
    print(len(T)-max_match-1)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
x = len(t)
mx= 0
# print(x - mx)

res= 0
for i in range(len(s) - x):
    tmp = s[i:i+x]
    cntmp = 0
    for j in range(x):
        if t[j] == tmp[j]:
            cntmp += 1
    # print(tmp, i)
    res = max(res, cntmp)
print(x-res)

Submission status: Wrong Answer

Solution code:
def check(S,T,i):
	count=0
	for j in range(i,len(T)+i):
		if S[j] == T[j-i]:
			count+=1
	return count

S=input()
T=input()
b=[]
for i in range(0,len(S)-len(T)+1):
	b.append(check(S,T,i))
b.sort()
print(b[0])

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
import math
if T in S:
    print(0)
    exit()
for i in range(1,len(T)):
        if T[i:] in S or T[:-i] in S:
            print(i)
            exit()

Submission status: Wrong Answer

Solution code:
L = input()
S = input()
result = 0

for i in range(len(S)):
    tmp = 0
    for j in L[i:]:
        if i + tmp > len(S)-1:
            break
        if S[i+tmp] == j:
            tmp += 1
        else:
            if result < tmp:
                result += tmp
            tmp = 0
print(len(S) - result)

Submission status: Wrong Answer

Solution code:
def core(s, t):
  if t in s:
    return 0
  for i in range(1, len(t)):
    for j in range(i+1):
      tempt = t[j:len(t)-i+j]
      temps = s[j:len(s)-i+j]
      if tempt in temps:
        return i
  return len(t)
  
if __name__ == "__main__":
  strings = [input() for i in range(2)]
  print(core(strings[0], strings[1]))

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
ns = len(s)
nt = len(t)

ans = nt
for i in range(ns-nt):
    count=0
    for j in range(nt):
        if not s[i+j] == t[j]:
            count += 1
    ans = min(count,ans)

print(ans)

Submission status: Wrong Answer

Solution code:
S = str(input())
T = str(input())
tempcount = 0
mincount = 0

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

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)

Submission status: Wrong Answer

Solution code:
s= input()
t= input()
a = len(s)
b = len(t)
i = 0
j = 0
cnt = 0
ans = b
while(j <= a - b):
    while (i < b):
        if (s[i + j] != t[i]):
            cnt+=1
        i+=1
    ans = min(b, cnt)
    cnt = 0
    i = 0
    j+=1
print(ans)

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

S = str(input())
T=str(input())
ans = 0
temp = 0


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

print(len(T)-ans)

Submission status: Wrong Answer

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

    min_v = len(t)

    for i in range(len(t)):
        if t[i:] in s and len(t) - len(t[i:]) < min_v:
            min_v = len(t) - len(t[i:])
        elif t[:len(t)-i] in s and len(t) - len(t[:len(t)-i]) < min_v:
            min_v = len(t) - len(t[:len(t)-i])

    print(min_v)
        
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
xmoji=input()
ymoji=input()

x=len(xmoji)
y=len(ymoji)
tempmin = 0
for i in range(0,x-y):
    xmin=xmoji[i:i+y]
    samenum=0
    for j in range(0,y):
        if(xmin[j]==ymoji[j]):
            samenum+=1
    if(tempmin<samenum):
        tempmin = samenum 
print(y-tempmin)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    s = input()
    t = input()
    if t in s:
        print(0)
        sys.exit()
    lent = len(t)
    r = 1
    while r < lent:
        if t[r:] in s:
            print(r)
            sys.exit()
        elif t[:-r] in s:
            print(r)
            sys.exit()
        r += 1
    print(lent)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

S = input()
T = input()

counter = 0
max_counter = 0

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

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

Submission status: Wrong Answer

Solution code:
def judge(s,t):
  if t in s:
    return 0
  for i in reversed(range(len(t))):
    for j in range((len(t)-i)+1):
      if t[0+j:i+j] in s[:-1]:
        if s.find(t[0+j:i+j])>=j:
          if len(s)-(s.find(t[0+j:i+j])+i)>=len(t)-(i+j):
            return len(t)-i

s = input()
t = input()

r = judge(s,t)
print(r)

Submission status: Wrong Answer

Solution code:
sList = list(input())
tList = list(input())
numList = []
 
for ti,t in enumerate(tList):
  num = 0
  for si,s in enumerate(sList):
    tnum = ti
    snum = si
    isSame = t == s
    while isSame:
      num += 1
      tnum += 1
      snum += 1
      if tnum >= len(tList): break
      if snum >= len(sList): break
      isSame = tList[tnum] == sList[snum]
  numList.append(num)
  if max(numList) > (len(sList) - ti): break

print(len(tList) - max(numList))

Submission status: Wrong Answer

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

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

  
print(num)

Submission status: Wrong Answer

Solution code:
def f(l,s):
	c=0
	for i in range(len(l)):
		if l[i]==s[i]:
			c+=1
	return len(l)-c

t=input()
sub=input()
n=len(t)
m=len(sub)
if m>n:
	t,sub=sub,t
c=m
for i in range(0,n-m):
	c=min(c,f(t[i:i+m],sub))
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(len(T)):
  if S.find(T[i:]) > -1 or S.find(T[0:len(T)-i]) > -1:
    print(i)
    break
  elif i == len(T)-1:
    print(len(T))
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
c = 0
pos = False
while len(t) > 0:
    if t in s:
        print(c)
        pos = True
        break
    else:
        c += 1
        t = t[:-1]
if not pos: print(c - 1)

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

S = str(input())
T=str(input())
ans = 0
temp = 0


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

print(len(T)-ans)

Submission status: Wrong Answer

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

for i in range(len(T)):
  if S.find(T[i:]) > -1 or S.find(T[0:len(T)-i]) > -1:
    print(i)
    break
  elif i == len(T)-1:
    print(len(T))

Submission status: Wrong Answer

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

    maxdiff = 0
    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 > maxdiff):
                maxdiff = count
    print(maxdiff)


def main():
    probB()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

def longestSubstringFinder(string1, string2):
    answer = ""
    len1, len2 = len(string1), len(string2)
    for i in range(len1):
        match = ""
        for j in range(len2):
            if (i + j < len1 and string1[i + j] == string2[j]):
                match += string2[j]
            else:
                if (len(match) > len(answer)): answer = match
                match = ""
    return answer

S = input()
T = input()
answert =  longestSubstringFinder(S,T)

if T == S:
    print(0)
else:
    lent = len(T)-1
    lenan = len(answert)
    print(lent-lenan)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

min_count = 10000000

for k in range(len(T)):
  count = k
  for i in range(len(S)-len(T)+1):
    if S[i+k] == T[k]:
      for j in range(1,len(T)-k):
        if S[i+j] != T[k+j]:
          count += 1
      if count < min_count:
        min_count = count
        
print(min_count)

Submission status: Wrong Answer

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

if t in s:
    print("0")

num = 0;
cnt = 0
min = len(t)
for i in range(len(s)-len(t)+1):
    ss = s[num:num+len(t)]
    for x,y in zip(ss,t):
        if x != y:
            cnt += 1
    if cnt < min:
        min = cnt
    cnt = 0
    num = num +1

print(min)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

S = input()
T = input()

lis = list(T)

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

print(len(T) - max_count)