Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
s = input()
t = input()


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


print(len(t)-ans)


s = input()
t = input()


ans = len(t)
flag = False


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

    ans = min(ans, dif)

print(ans)


s = input()
t = input()


ans = len(t)
flag = False


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

    ans = min(ans, dif)

print(ans)


#    for j in range(0, len(t)-i+1):

#        if sb in s[j:]:

#            ans = len(t)-len(sb)

#            break
#
#    if flag:
#        break


print(ans)


s = input()
t = input()


ans = 0
flag = False
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[j:]:
            ans = i
            break


print(len(t)-ans)


n = int(input())
a = list(map(int, input().split()))

sums = 0
for i in range(n-1):
    for j in range(i+1, n):
        sums += (a[i] * a[j])

print(sums % (10 ** 9 + 7))


s = input()
t = input()


ans = len(t)
flag = False
for i in range(len(t)+1, 0, -1):
    for j in range(0, len(t)-i+1):
        sb = t[j:j+i]
        if sb in s[j:]:
            ans = len(t)-len(sb)


print(ans)


s = input()
t = input()


ans = 0
flag = False
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:
            for i in range(0, len(t)-len(t[j:j+i])):
                try:
                    ind = s.index(t[j:j+i])
                    if ind >= j and len(s[ind:]) - len(t[j:]) >= 0:
                        print(t[j:j+i])
                        ans = i
                        flag = True
                        break
                except:
                    pass

    if flag:
        break


print(len(t)-ans)


s = input()
t = input()


ans = 0
flag = False
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[j:-len(s[j+i:len(t)])]:
            ans = i
            break


print(len(t)-ans)


s = input()
t = input()


ans = 0
flag = False
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:
            
            ind = s.index(t[j:j+1])
            if ind >= j and len(s) - ind - len(t[j:j+1]) > 0:
                ans = i
                flag = True
                break

    if flag:
        print('test')
        break


print(len(t)-ans)


# -*- coding: utf-8 -*-
s = input()
t = input()

ans = len(t)

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

    ans = min(ans, dif)

print(ans)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted