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:
from sys import stdin

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()

def strpair(str,n):
    arr = []
    for i in range(0,len(str)-n+1):
        arr.append(str[i:i+n])
    return arr




def count(s,t):
    # if s.count(t) >= 1:
    #     return 0
    arr = []
    count = 0
    for i in range(1,len(t)+1):
        arr = strpair(t,len(t)-i)
        for a in arr:
            if s.count(a) >=1 :
                return i
print(count(s,t))

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
Answer = len(T)
for i in range(0,len(S)-len(T)):
    String = S[i:i+len(T)]
    for j in range(len(String)):
        B = len(T)
        if String[j] == T[j]:
            B -= 1
        Answer = min(Answer,B)
print(Answer)

Submission status: Wrong Answer

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

l = len(s)
k = len(t)
min = 1002

for j in range(0,k):
    t1 = t[0:k-j]
    for i in range(0,l-k+j+1):
        s1 = s[i:i+k-j]
        if t1 == s1:
            if min > k-i-1:
                min = k-i-1
                break
    if min != 1002:
        break
            
print(min)

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    T = input()
    min = 1000000

    k=0
    for i in range(len(T)):
        i = i
        for j in range(len(T)):
            k = len(T)-j-1
            if T[i:i+k] in S:
                min = len(T)-len(T[i:i+j])
                break

    return min-1

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

Submission status: Wrong Answer

Solution code:
S = str(input())
T = str(input())
con2 = len(T)
a = 0
if T in S:
  print(0)
for i in T:
  if i not in S[ a:len(S) -len(T) + a]:
    a += 1  
  if i in S[a: len(S) - len(T) + a]:
    con2 -= 1
    a += 1
    break
for b in range(1,len(T)- a + 1):
  c = T[a-1: a-1 + b]
  if c in S:
    con2 -= 1
  
print(con2)

Submission status: Wrong Answer

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

# print(t[0: 0])


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

# if t[0] not in s:
#     print(0)

len_t = len(t)
# print(len_t)

times = len(s) - len(t) + 1
# count = []

# for j in reversed(range(len_t+1)):
#     for i in range(times):
#         if t[0:j] in s[i:len_t+i]:
#             print(len_t - j-1 )
#             break
#     else:
#         continue
#     break

for i in range(len_t):
    for j in reversed(range(1, len_t+1)):
        if t[i:j] in s:
            if j-i -1 > 0:
                print(j-i -1)
            else:
                print(len_t - 1)
            break
    else:
        continue
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
count=10000000000
COUNT=0
for j in range(len(s)-len(t)+1):
    for i in range(len(t)):
        if not t[i]==s[j]:
            COUNT+=1
    count=min(count,COUNT)
print(count)

Submission status: Wrong Answer

Solution code:
P = [input().split() for i in range(2)]

s_a = P[0]
S = s_a[0]
t_a = P[1]
T = t_a[0]

s_len = len(S)
t_len = len(T)

max_y = 0

for x in range(s_len - t_len):

    y = 0
    for t in T:
        if t == S[x]:
            y = y+1
            x = x+1
        else:
            x = x+1

    if y > max_y:
        max_y = y

print(t_len - max_y)

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    T = input()
    if T in S:
        print(0)
    else:
        for i in range(len(T)-1, 0, -1):
            for j in range(len(T)-i+1):
                if T[j:j+i] in S[j:]:
                    print(len(T) - i)
                    exit()
        else:
            print(len(T))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
c =0
C = [0]
for i in range(len(S)):
  c = 0
  for j in range(len(T)):
    if S[i] == T[j] and i-j >= 0 and len(S)-i -1 >= len(T)-j -1:
      
      c = 1
      if not(i == len(S)-1 and j == len(T)-1):
        for k in range(len(T) - j-2):
          if S[i + k + 1] == T[j + k +1]:
            c += 1
      C.append(c)
      c = 0
C.append(c)

print(len(T)-max(C))

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()
    if len(s) == 1 and len(t) == 1:
        if s in t:
            print(0)
            sys.exit()
        else:
            print(1)
            sys.exit()

    lent = len(t)
    lens = len(s)
    res = []
    for i1 in range(lent):
        tmp1 = t[i1:]
        for i2 in range(lent, i1, -1):
            end = lens - (lent - i2)
            if t[i1:i2] in s[i1:end]:
                res.append(i1 + (lent - i2))
    if res:
        r = min(res)
        print(r)
    else:
        print(lent)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
SL=len(S)
TL=len(T)
ans2=0
for i,key1 in enumerate(T):
    for j,key2 in enumerate(S):
        ans=0
        if key1==key2 and j>=i and j-i<=SL-TL:
            ans+=1
            while True:
                i+=1
                j+=1
                if TL<i+1 or SL<j+1:
                    break
                if T[i]==S[j]:
                    ans+=1
        ans2=max(ans2,ans)
print(TL-ans2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
max_s = 0
max_temp = 0

for i in range(len(S)-len(T)+1):
    for j in range(len(T)):
#        print('S:{} T:{}'.format(S[i+j], T[j]))
        if S[i+j] == T[j]:
            max_temp = max_temp + 1
            if max_s < max_temp:
                max_s = max_temp
        else:
            max_temp = 0
#        print(max_temp)
#        print(max_s)

print(len(T)-max_s)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
lis1 = list(T)
lis2 = list(S)
ans_list = []
ch = True
for i in range(len(T)):
  for j in range(len(S)):
    if lis1[i] == lis2[j]:
      ans = 1
      ch = True
      if len(S) - j < len(S) - i or j < i:
        continue
      else:
        while ch == True:
          p = i
          q = j
          if p+1 < len(T) and q+1 < len(S) and lis1[p + 1] == lis2[q + 1]:
            ans += 1
            p += 1
            q += 1
          else:
            ch = False
            ans_list.append(len(T)-ans)
if ans_list == []:
  print(len(T))
else:
  print(max(ans_list))

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:
def Qb():
    s = input()
    t = input()

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

if __name__ == '__main__':
    Qb()

Submission status: Wrong Answer

Solution code:
s = input("")
t = input("")
ts = ""
j = len(t)
e = []
for a in range(j+1):
  for b in range(j):
    i = 0
    if b < (len(t)-a):
      ts = t[b:(len(t)-a)]
      sf = s.find(ts)
      if sf != -1 and (((sf+len(ts)+a) <= len(s)) and ((sf-b) >= 0)):
        ss = s[sf-b:sf+len(ts)+a]
        for c in range(len(t)):
          if t[c] == ss[c]:
            i += 1
        e.append(len(t)-i)
    else:
      break
if e == []:
  print(len(t))
else:
  print(min(e))

Submission status: Wrong Answer

Solution code:
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()
print(len(T)-len(longestSubstringFinder(S, T)))

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
maxSame = 0
time = len(T)

for i in range(time):
  if T in S:
    if maxSame < len(T):
      maxSame = len(T)
      break
  T = T[:-1]

print(len(T) - maxSame)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
count = 0
def ans(s, t):
    for i in range(len(t),0,-1):
        for j in range(len(t)-i+1):
            t2 = t[j:i+j]
            for k in range(j, len(s)-j-i+1):
                if t2 == s[k:k+i]:
                    return len(t)-i
    return len(t)
print(ans(s,t))

Submission status: Wrong Answer

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


maxans = 1000000000000000
# j_his = -1
# i = 0
# j = -1
# while (abs(j_his) < len(t)):
#     count = 0
#     while(j < 0):
#         # print(s[i],t[j])
#         # print(i,j)
#         if(s[i] == t[j]):
#             count += 1
#         maxans = max(count,maxans)
#         i += 1
#         j += 1
#     # print("maxans",maxans)   
#     i = 0
#     j_his -= 1
#     j = j_his
#     # print(j)


i_his = 0
i = 0
j = 0
while (i < len(s)):
    count = 0
    while (j < len(t)):
        if(s[i] == t[j]):
            pass
        else:
            count += 1
        if(count != 0):
            maxans = min(count,maxans)
        i += 1
        j += 1
        if(i >= len(s)):
            break
    j = 0
    i_his += 1
    i = i_his

# i = -(len(t)-1)
# i_his = i
# j = -1
# while (abs(i_his) < len(s)):
#     count = 0
#     while(i < 0):
#         # print(s[i],t[j])
#         # print(i,j)
#         if(s[i] == t[j]):
#             count += 1
#         maxans = max(count,maxans)
#         i += 1
#         j += 1
#     # print("maxans",maxans)   
#     i_his += 1
#     j = 0
#     i = i_his
#     # print(j)
print(maxans)

Submission status: Wrong Answer

Solution code:
import numpy as np
S = str(input())
T = str(input())
len_T=len(T)
ls=[]
for i, t in enumerate(T):
    count = 0
    #print(i)
    for j, s in enumerate(S):
        #print(j)
        #print(t,s)
        if (len_T + j - i > len(S)):
            #print(j,i,t,s)
            break

        if (j - i < 0):
            continue

        if t == s:
            #print(t,s)
            #print(j, i, t, s)
            tmp=S[j-i:len_T+j-i]
            #print(tmp)
            #print(tmp)
            for x, y in zip(tmp,T):
                if x!=y:
                    count+=1
            ls.append(count)
                #break
#print(ls)
if len(ls)==0:
    print(len_T)
else:
    print(np.min(ls))

Submission status: Wrong Answer

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

min_ = 10000
for i in range(len(s) -len(t) + 1):
    tmp = 0
    t_t = s[i:i+len(t)]
    for n,m in zip(t, t_t):

        if n != m:
            tmp += 1
    if min_ > tmp:
        min_ = tmp

print(tmp)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
r = 0
maxt = 0
for x in range(0, len(S), len(T)):
  r = 0
  for y in range(len(T)):
    if len(S[0+x:len(T)+x])< len(T):
      break
    if T[y] == S[0+x:len(T)+x][y]:
      r += 1
  maxt = max(maxt,r)
print(len(T)- maxt)

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    T = input()
    if T in S:
        print(0)
    else:
        for i in range(len(T)-1, 0, -1):
            for j in range(len(T)-i+1):
                if T[j:j+i] in S[j:]:
                    print(len(T) - i)
                    exit()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
SL=len(S)
TL=len(T)
ans2=0
for i,key1 in enumerate(T):
    for j,key2 in enumerate(S):
        ans=0
        if key1==key2 and j>i and j-i<=SL-TL:
            ans+=1
            while True:
                i+=1
                j+=1
                if TL<i+1 or SL<j+1:
                    break
                if T[i]==S[j]:
                    ans+=1
        ans2=max(ans2,ans)
print(TL-ans2)

Submission status: Wrong Answer

Solution code:
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(t[i:k], k - i)
#print(cnt)
    print(len(t) - max(cnt))

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
count = 0
def ans(s, t):
    for i in range(len(t),0,-1):
        for j in range(len(t)-i+1):
            t2 = t[j:i+j]
            for k in range(j, len(s)-j-i+1):
                if t2 == s[k:k+i]:
                    return len(t)-i
print(ans(s,t))

Submission status: Wrong Answer

Solution code:
import numpy as np
S = np.array(list(input().rstrip()))
T = np.array(list(input().rstrip()))

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

max_count = 0

for i in range(s-t):
  max_count = max(max_count, (S[i:i+t]==T).sum())
      
print(len(T) - max_count)

#print(S[5:5+1])
#print(T[-(10-5):5+1])
#print(S[5:5+1] in T[-(10-5):5+1])

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
t_copy = t
status = 0
result = 0
if t in s:
  print(0)
else:
  for i in reversed(range(1,len(t))):
    if status == 1:
      break
    for k in range(len(t)-i+1):
      tn = t[k:k+i]
      if tn in s:
        result = len(t)-i
        status += 1
        break
if status <= 1:
  for i in range(1,len(t)):
    if status >= 2:
      break
    for k in range(1,len(t)-i):
      if status >= 2:
        break
      t1 = t[:k]
      t2 = t[k+i:]
      if t1 in s and t2 in s:
        while True:
          t1_ind = s.index(t1)
          t2_ind = s.index(t2)
          if len(s[t1_ind+len(t1):t2_ind]) == i:
            if result > i:
                result = i
            status += 1
            break
  
if status == 0:
  print(len(t))
else:
  print(result)

Submission status: Wrong Answer

Solution code:
from difflib import SequenceMatcher 

def ls(str1,str2,f): 
     seqMatch = SequenceMatcher(None,str1,str2) 
     match = seqMatch.find_longest_match(0, len(str1), 0, len(str2))
     while (match.a==0 and match.b!=0 and f==0):
         f=1
         match=ls(str1[match.a+match.size+1:],str2,f)
        
     else:
        return(match)
    #  print(match)
    #  return(0)
     
if __name__ == "__main__":
    s=str(input())
    t=str(input())
    ct=0
    f=0
    sz=ls(s,t,f)
    print(len(t)-sz.size)

Submission status: Wrong Answer

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

t_len = len(t)


done = False
for n in range(t_len+1):
    if done:
        break
    index = 0
    for nn in range(n):
        target = t[index:(t_len-n+1)+nn]
        if target in s:

            if s.index(target) < index:
                index += 1
                continue
            if t_len -(s.index(target) + len(target)) < t_len-((t_len-n+1)+nn):
                index += 1
                continue

            print(index)

            done = True
            break
        index += 1
if done == False:
    print(t_len)

Submission status: Wrong Answer

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

    common = 0
    max_common = 0
    len_t = len(t)
    len_s = len(s)
    break_t = False
    break_s = False
    for s_ind in range(len_s):
        if break_s:
            break_s = False
            if common and common > max_common:
                max_common = common
            common = 0
            continue
        for t_ind in range(len_t):
            if break_s:
                break
            if break_t:
                break_t = False
                if common and common > max_common:
                    max_common = common
                common = 0
                continue
            for char in s[s_ind:len_s]:
                if common == len_t:
                    break_t = True
                    break
                elif t_ind + common + 1 == len_t:
                    break_t = True
                    break
                elif s_ind + common + 1 == len_s:
                    break_s = True
                    break
                elif not common and char == t[t_ind]:
                    common += 1
                elif char == t[common]:
                    common += 1
                else:
                    if common and common > max_common:
                        max_common = common
                    common = 0
    print(len_t - max_common)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
ans = 0
ret = False
for i in range(len(T)):
    # print(i)
    for j in range(i+1):
        if i == 0:
            # print("**")
            compare = T
        else:
            compare = T[j:len(T) - i + j]
        # print(j, compare)
        for k in range(j, len(S)):
            # print(S[j+k:j+k+len(compare)-1])
            if compare in S[j+k:j+k+len(compare)]:
                print(len(T) - len(compare))
                # print("+++")
                ret = True
                break
        if ret:
            break
    if ret:
        break
if not ret:
     print(len(T))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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 >= len(T)-i and A > len(T)-i:
        A = len(T)-i 
    M = S.rfind(T[:i])
    if M >= len(T)-i and A > len(T)-i:
        A = len(T)-i 
print(A)

Submission status: Wrong Answer

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext


# input = sys.stdin.readline
def i_input(): return int(input())


def i_map(): return map(int, input().split())


def i_list(): return list(i_map())


def i_row(N): return [i_input() for _ in range(N)]


def i_row_list(N): return [i_list() for _ in range(N)]


def s_input(): return input()


def s_map(): return input().split()


def s_list(): return list(s_map())


def s_row(N): return [s_input for _ in range(N)]


def s_row_str(N): return [s_list() for _ in range(N)]


def s_row_list(N): return [list(s_input()) for _ in range(N)]


def lcm(a, b): return a * b // gcd(a, b)


sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []


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

    sl = len(s)
    tl = len(t)

    min = len(t)
    for i in range(min):
        tt1 = t[i:]
        tt2 = t[0:tl - i]
        if 0 <= s.find(tt1) < sl or 0 <= s.find(tt2) < sl:
            min = i
            break

    print(min)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

len_t = len(t)
list_t = list(t)
diff_min = len_t

for start in range(len(s)-len_t):
    list_s_part = list(s[start:start+len_t])
    diff = 0
    for t_item, s_item in zip(list_t, list_s_part):
        if t_item != s_item:
            diff += 1
    if diff < diff_min:
        diff_min = diff

print(diff_min)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
sl = len(S)
tl = len(T)
ans = tl
for i in range(sl - tl + 1):
    flag = 0
    tmp = 0
    for j in range(tl):
        if S[j + i] == T[j]:
            tmp += 1
            flag = 1
    if flag == 1:
        ans = min(ans,tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(1000000)
from collections import deque
import re

S=input()
T = input()

num = len(T)

for i in range(num, 0, -1):
    for start in range(num):
        if start + (i-1) >= num:
            break
        s = T[start:start+i]
        a = num - start - i
        tmp = S[start:-a]
        result = re.search(s,tmp)
        if result!=None:
            print(num-i)
            exit(0)

print(num)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
c =0
C = [0]
for i in range(len(S)):
  for j in range(len(T)):
    if S[i] == T[j] and i-j >= 0 and len(S)-i -1 >= len(T)-j -1:
      
      c = 1
      if i == len(S)-1 and j == len(T)-1:
        break
      else:
        for k in range(len(T) - j-2):
          if S[i + k + 1] == T[j + k +1]:
            c += 1
      C.append(c)
      c = 0
C.append(c)


print(len(T)-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:
def count(A,B):
    counter=0
    for i in range(len(A)):
        if A[i]==B[i]:
            counter+=1
    return len(A)-counter

S = input()
T = input()
t = len(T)
s = len(S)
_min = float('inf')
for i in range(s-t+1):
    print(S[i:i+t])
    _min = min(_min,count(S[i:i+t],T))
print(_min)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
A = len(T)
for i in range(len(T)-1):
    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 >= len(T)-i and A > len(T)-i:
        A = len(T)-i 
    M = S.rfind(T[:i])
    if M >= len(T)-i and A > len(T)-i:
        A = len(T)-i 
print(A)

Submission status: Wrong Answer

Solution code:
import re

S = input()
T = input()
k = 0 

if re.search(T, S):
    print(0)
else:
    for i in S:
        k +=1
        if re.search(T[0:len(T)-k], S):
            break
        
    
    print(k)

Submission status: Wrong Answer

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

print(count)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
maxSame = 0
time = len(T)

for i in range(time):
  if T in S:
    if maxSame < len(T):
      maxSame = len(T)
  T = T[:-1]

print(len(T) - maxSame)

Submission status: Wrong Answer

Solution code:
import random, string
def randomname(n):
   randlst = [random.choice(string.ascii_letters + string.digits) for i in range(n)]
   return ''.join(randlst)
S = input()
T = input()
l = len(T)
L = len(S)
before = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(l))
after = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(l))
S = before + S + after
max_ans = -1
for i in range(L+l+1):
   for j in range(l):
      ans = 0
      if T[j] == S[i + j]:
         ans += 1
   max_ans = max(max_ans, ans)
print(l - max_ans)

Submission status: Wrong Answer

Solution code:
import sys
S = input()
T = input()
x = 0
y = 0
count = 0
if len(S) == len(T):
  for h in range(len(S)):
    if S[h] == T[h]:
      pass
    else:
      count += 1
  if count > 0:
    print(count)
    sys.exit()
  else:
    print("0")
    sys.exit()
else:
  pass
for i in range(len(S)):
  if T[0] == S[i]:
    x += (i+1)
    break
  else:
    pass
if len(S) - x + 1 < len(T):
  print("0")
  sys.exit()
else:
  pass
for r in range(int(len(T)-1)):
  if T[int(r+1)] == S[int(r+x)]:
    pass
  else:
    y += 1
print(y)

Submission status: Wrong Answer

Solution code:
s = str(input())
t = list(input())
b = len(t)
a = 1
tt = ''.join(t)
ans = 0
ss = list(s)
for i in range(len(t),0,-1):

    for j in range(len(t)-i+1):
        tt = ''.join(t[j:j+i])

        if tt in ''.join(ss[j:]):
            ans = b-len(tt)
            print(ans)
            exit()
            
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys

if __name__ == '__main__':
    S = input()
    T = input()
    
    for i in range(len(T), 0, -1): #Tのsubstringの文字数
        for j in range(0, len(T)-i+1): #Tのsubstringの開始位置
            #print (T[j:i-1+j+1])
            k = S.find(T[j:i-1+j+1])
            if k != -1:
                if len(S)-1 >= k + len(T) - 1 - j: # うしろ
                    if k - j >= 0: # まえ
                        print (len(T)-i)
                        sys.exit()
                
    print (0)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
A = len(T)
print(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 >= len(T)-i and A > len(T)-i:
        A = len(T)-i 
    M = S.rfind(T[:i])
    if M >= len(T)-i and A > len(T)-i:
        A = len(T)-i 
print(A)

Submission status: Wrong Answer

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

m = 0
l = len(t)
# print(l)
ans = 100000000
for tt in range(0,l):
    for pp in range(l , tt, -1):
        # print(t[tt:pp])
        if t[tt:pp] in s[tt:len(s)-(l-pp)]:
            # print("ok ", tt + (l-pp))
            if ans > tt + (l-pp):
                ans = tt + (l-pp)


print(ans)