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:
def compute(a,b):
	# print(a,b)
	n = len(a)
	cnt = 0
	for i in range(n):
		if(a[i] != b[i]):
			break
		cnt+=1
	return cnt

s = input()
t = input()
# print(s,t)


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

ans = tl

tmp1 = s[0:tl]
tmp2 = t 
# print(compute(tmp1,tmp2))
ans = min(tl - compute(tmp1,tmp2), ans)
ans = min(tl - compute(tmp1[::-1], tmp2[::-1]), ans)

for i in range(sl-tl):
	tmp1 = s[i:i+tl]
	tmp2 = t
	ans = min(tl - compute(tmp1,tmp2), ans)
	ans = min(tl - compute(tmp1[::-1], tmp2[::-1]), ans)

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
s = len(S)
t = len(T)

count = 0
max = 0

for i in range(s-t):
  for j in range(t):
    if S[i+j] == T[j]:
      count += 1
  if count > max:
    max = count
    count = 0
  else:
    count = 0

print(t-max)

Submission status: Wrong Answer

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

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

    maxequal = 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 > maxequal):
                maxequal = count
    print(len(T) - maxequal)

def main():
    probB()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = str(input())
T = str(input())
init = len(T)
tmp = init
ans = tmp
for i in range(0,len(S)-1):
    if i > len(S)-len(T):
        break
    for n in range(0, len(T)-1):
        if S[i]==T[n]:
            ans -=1
            if ans < tmp:
                tmp =ans
        else:
            ans = init


ans = tmp
print(ans)

Submission status: Wrong Answer

Solution code:
import re

def judge(T,S):
  length=len(T)
  if T in S:
    return length
  else :
    for i in range(1,length):
      for j in range(length):
        t=T[:j]+"."*i+T[j+i:length]
        if re.search(t,S):
          return i
          break


S=input()
T=input()

print(judge(T,S))

Submission status: Wrong Answer

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

min_count = len(T)
for s_i in range(len(S)):
    i = s_i
    matched = 0
    for j in range(len(T)):
        i += 1
        if len(S) <= i:  # Out of S
            matched = 0  # Cannot append characters to S
            break
        if S[i] == T[j]:
            matched += 1
    count = len(T) - matched
    if count < min_count:
        min_count = count
print(min_count)

Submission status: Wrong Answer

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

res = len(T)

for i in range(len(S)-len(T)):
    count = 0
    for j, t in enumerate(T):
        if S[i+j] != t:
            count += 1
    if count < res:
        res = count

print(res)

Submission status: Wrong Answer

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


for j in range(len(S)-len(T)+1):
    total=0
    for i in range(len(T)):
        if S[i+j-1]!=T[i]:
            total+=1
    if ans>=total:
        ans=total
        
print(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:
s = input()
t = input()
N = len(s)
n = len(t)
m = 0
T = list(t)
for i in range(N-n):
    cnt = 0
    S = list(s)[i:i+n]
    for j in range(n):
        if S[j] == T[j]:
            cnt += 1
    if m < cnt:
        m = cnt
print(n-m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def count_equals(s_, t_):
    i = 0
    j = 0

    for i in range(len_t):
        if s_[i] != t_[i]:
            break

    for j in range(len_t - 1, -1, -1):
        if s_[j] != t_[j]:
            break

    return i if i > (len_t - j - 1) else (len_t - j - 1)

len_s = len(s)
len_t = len(t)
max_t = 0

if len_s == len_t:
    print(len_s - count_equals(s, t))
    exit()

for i in range(0, len_s - len_t + 1):
    equals = count_equals(s[i : i + len_t], t)

    if equals > max_t:
        max_t = equals

print(len_t - max_t)

Submission status: Wrong Answer

Solution code:
s = input() 
t = input() 
 
i, j = 0, 0 
longest = 0 
for i in range(len(t)): 
    count = 0 
    base_i = i 
     
    for j, c in enumerate(s[i:]): 
        if i >= len(t): 
            i = base_i 
        if len(s[i+j:]) < len(t[i:]): 
            break  
        if t[i] == c: 
            count += 1 
            i += 1 
            longest = max(longest, count) 
        else: 
            i = base_i  
            count = t[i] == c 
            i += count 
print(len(t)-longest)

Submission status: Wrong Answer

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

cand = []
for start in range(len(S) - len(T) + 1):
    print(S[start:start+len(T)])
    cnt = sum([not T[i] == S[start:start+len(T)][i] for i in range(len(T))])
    cand.append(cnt)

print(min(cand))

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

Submission status: Wrong Answer

Solution code:

def solve():
    s=input()
    t=input()
    ans=len(t)
    for i in range(0,len(s)-len(t)) :
        diff=0
        for j in range(0,len(t)) :
            diff+= 1 if s[i+j]!=t[j] else 0
            if diff>ans :
                break
        ans=min(ans,diff)
    return ans

print(solve())

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

Submission status: Wrong Answer

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

max_len = 0
for start in range(len(t)):
    for end in range(start+1, len(t)):
        if t[start:end] in s[start:len(s)-(len(t)-end-1)]:
            max_len = max(max_len, end - start)

print(len(t)-max_len)

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
res=float("INF")
if t in s:
    res=0
else:
    for i in range(len(s)):
        for j in range(len(t)):
            if s[i]==t[j] and i>=j and len(s)-i>=len(t)-j :
                tmp=j
                for k in range(j,len(t)):
                    if i-j+k<(len(s)) and s[i-j+k] != t[k]:
                        tmp+=1
                res=min(res,tmp)


print(res)

Submission status: Wrong Answer

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

TN = []
ans = [0]

for i in range(len(T)):
    TN += T[i]
    TN=''.join(TN)

    if S.find(T[i]):
        ans.append(1)

    if (TN in S) == True:
        ans.append(len(TN))

print(len(T) - max(ans))

Submission status: Wrong Answer

Solution code:
import re
import sys
s = input()
t = input()
t1 = t
t2 = t
for i in range(len(t)):
  if  re.search(t,s) != None:
    print(0)
    sys.exit()
  t1 = t1[1:]
  t2 = t2[:len(t)-(i+1)]
  if None!=re.search( ".+"+t1+".+",s):
    print(i+1)
    sys.exit()
  if None!=re.search( ".+" + t2 + ".+",s):
    print(i+1)
    sys.exit()
    
  if i == len(t)-1:
    
    print(len(t))

Submission status: Wrong Answer

Solution code:
import numpy as np
S = input()
T = input()

tmp = np.zeros(len(T))

i=0
flg=True

while flg:
    for j in range(i, len(T)):
        print(i,j)
        print(T[i:j+1])
        print(T[i:j+1] in S)
        if T[i:j+1] in S:
            tmp[i] = j+1
    i = i + int(tmp[i])
    if i >= len(T)-1:
        flg=False

print(len(T)-int(np.max(tmp)))

Submission status: Wrong Answer

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

max_len = 0
for start in range(len(t)):
    for end in range(start+1, len(t)):
        if t[start:end] in s[start:len(s)-(len(t)-end)]:
            max_len = max(max_len, end - start)

print(len(t)-max_len)

Submission status: Wrong Answer

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

flg = False

for i in range(len(part)):
  for j in range(i + 1):
    # atcoder -> atcode
    # print(part[j:len(part)-i])
    target = str[j: -(i - j)]
    search = part[j:len(part) - (i - j)]
    if search in target:
      print(i)
      flg = True
      break
  
  if flg:
    break

if not flg:
	print(len(part))

Submission status: Wrong Answer

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

s = input()
t = input()

ans = 10**5

len_s = len(s)
len_t = len(t)

S = []

for i in range(len_s):
    S.append(s[i])

for i in range(len_s - len_t):
    tmp = 0
    ss = S[i:i+len_t]
    for j in range(len_t):
        if t[j] != ss[j]:
            tmp += 1
    if tmp < ans:
        ans = tmp

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ls = len(s)
lt = len(t)
mx = 0
for i in range(ls -lt):
#  print(s[i])
  c = 0
  for j in range(lt):
    if s[i+j] == t[j]:
      c+= 1
#    print(s[i+j], t[j])
  if c > mx:
    mx = c
print(lt - mx)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
result = [0]*len(s)
for i in range(len(s)):
    for j in range(len(t)):
        try:
            if s[i+j] == t[j]:
                result[i] += 1
        except:
            pass
print(len(t) - max(result))

Submission status: Wrong Answer

Solution code:

S = input()
T = input()

Slen = len(S)
Tlen = len(T)
i = 0

while i < Tlen:
    if T[i:] in S[i:]:
        print(i)
        break
    if T[:(Tlen-i)] in S[:(Slen-i)]:
        print(i)
        break
    i += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
t1=""
Sum=0
count=0
for i in range(len(t)):
    if t[i] in s:
        d=s.index(t[i])
        if d<i:
            Sum=Sum+1
    else:
        Sum=Sum+1
    
            
        
print(Sum)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
l = len(t)
ans = l
for i in range(l):
    for j in range(i+1,l+1):
        #print(i,j)
        #print(t[i:j])
        fin = -(l-j)
        if j==l:
            fin = len(s)
        #print(s[i:fin])
        #print("---")

        if s[i:fin].count(t[i:j])>0:
            ans = min(ans,l-len(t[i:j]))
print(ans)

Submission status: Wrong Answer

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

max_same = 0
ans = 0

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

print(len(t)-ans)

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
res=float("INF")
for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j] and i>=j and len(s)-i>=len(t)-j :
            tmp=j
            for k in range(j,len(t)):
                if i-j+k<(len(s)) and s[i-j+k] != t[k]:
                    tmp+=1
            res=min(res,tmp)
print(res)

Submission status: Wrong Answer

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

    ans = len(t)
    for v in range(len(t)):
        v1 = t[0:len(t) - v]
        v2 = t[0 + v:]
        v3 = t[0 + v:len(t) - v]

        if v1 in s:
            id = s.index(v1)
            if len(t)-v < len(s) - id:
                ans = v
                break
        if v2 in s:
            id = s.index(v2)
            if len(t)-v < id:
                ans = v
                break
        if v3 in s:
            id = s.index(v3)
            if len(t)-v < len(s) - id and v < id:
                ans = v
                break
    print(ans)


if __name__ == '__main__':
    Qb()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S= input()
T= input()
s=len(S)
t=len(T)
a=0
for i in range(s-t):
    cnt=0
    for j in range(t):
        if S[i+j]==T[j]:
            cnt=cnt+1
    if cnt>a:
        a=cnt
print(t-a)

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:
          return len(t)-i

s = input()
t = input()

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
i_his = 0
i = 0
j = 0
ans = 0
ansmax = -1
while (i < len(s)):
    # print(i,j)
    ans = 0
    while (j < len(t)):
        # print(s[i],t[j])
        if(s[i] == t[j]):
            # print("!")
            ans += 1
        i += 1
        j += 1
        ansmax = max(ans,ansmax)
        if(i >= len(s)):
            break
    j = 0
    i_his += 1
    i = i_his

print(len(t)-ansmax)

Submission status: Wrong Answer

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

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
    if cnt < minDiff:
        minDiff = cnt
print(cnt)

Submission status: Wrong Answer

Solution code:
import re
import sys
s = input()
t = input()
t1 = t
t2 = t
for i in range(len(t)):
  if  re.search(t,s) != None:
    print(0)
    sys.exit()
  t1 = t1[1:]
  t2 = t2[:len(t)-i]
  if None!=re.search( ".+"+t1+".+",s):
    print(i+1)
    sys.exit()
  if None!=re.search( ".+" + t2 + ".+",s):
    print(i+1)
    sys.exit()
    
  if i == len(t)-1:
    
    print(len(t))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(result)

Submission status: Wrong Answer

Solution code:
# def partial_match_table(word):
#     table = [0] * (len(word) + 1)
#     table[0] = -1
#     i, j = 0, 1

#     while j < len(word):
#         matched = word[i] == word[j]

#         if not matched and i > 0:
#             i = table[i]
#         else:
#             if matched:
#                 i += 1
#             j += 1
#             table[j] = i

#     return table


# def kmp_search(text, word):
#     table = partial_match_table(word)
#     i, p = 0, 0

#     while i < len(text) and p < len(word):
#         if text[i] == word[p]:
#             i += 1
#             p += 1
#         elif p == 0:
#             i += 1
#         else:
#             p = table[p]

#     return (-1, i - p)[p == len(word)]


def match(s, t):
    ret = 0
    assert len(s) == len(t), (s, t)
    for i in range(len(s)):
        if s[i] == t[i]:
            ret += 1
    return ret


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

    for i in range(len(s)-len(t)):
        _ret = len(t) - match(s[i:i + len(t)], t)

        if ret > _ret:
            ret = _ret

    print(ret)


    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2, log10, pi
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key
from bisect import bisect_left


INF=1001001001
__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


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

def intinput():
    return int(input())

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

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

def bindex(a,x):
    i = bisect_left(a,x)
    if i != len(a) and a[i] == x:
        return i
    return None

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __radd__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x + self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x + self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rsub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x - self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x - self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rmul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x * self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x * self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rtruediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x * self.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x * self.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __rpow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(other.__x, self.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(other.__x, self.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")

    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x
    def __str__(self):
        return str(self.__x)



if __name__ == '__main__':
    S = input()
    T = input()

    i = 0
    ans = INF
    while i < len(S)-len(T):
        s = S[i]
        j, cnt = i, 0
        for t in T:
            if t == S[j]:
                cnt += 1
            j += 1
        if cnt == len(T):
            # matched
            print(0)
            exit()
        ans = min(ans, len(T)-cnt)
        i += 1
    if ans >= INF:
        print(len(T))
    else:
        print(ans)

Submission status: Wrong Answer

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

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

for i in range(len(S) - len(T)):
    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()

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

if flag == 0:
    print(l)

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,0,-1):
  for t_range in range(n-size):
    bubun = t[t_range:t_range+size]
    for s_range in range(t_range,len(s)-size):
      if bubun == s[s_range:s_range+size]:
        no_change = size
        break
    if no_change != 0:
      break
  if no_change != 0:
    break

print(n-no_change)

Submission status: Wrong Answer

Solution code:
s = input()
t = input() 
ans = 0
for i in range(len(t)+1):
  for j in range(len(t)+1):
    if i < j:
      t2 = t[i:j]
      #print(t2)
      if (t2 in s) and ans < j-i and i<=s.find(t2):
        ans = j-i
        #print(ans)
        #print(s.find(t2))
print(len(t)-ans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
if t in s:
    print(0)
else:
    ans = len(t)
    for i in range(len(t)):
        for j in range(len(s)):
            if t[i] == s[j]:
                if len(t) - i <= len(s) - j and i <= j:
                    k = i
                    l = j
                    cnt1 = 0
                    while k < len(t):
                        if t[k] != s[l]:
                            cnt1 += 1
                        k += 1
                        l += 1
                    k = i
                    l = j
                    cnt2 = 0
                    while k >= 0:
                        if t[k] != s[l]:
                            cnt2 += 1
                        k -= 1
                        l -= 1
                    ans = min(ans, cnt1 + cnt2)    
                else:
                    break
    print(ans)

Submission status: Wrong Answer

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

i, j = 0, 0
longest = 0
for i in range(len(t)):
    count = 0
    base_i = i
    if len(s[i:]) < len(t[i:]):
        break
    for c in s[i:]:
        if i >= len(t):
            i = base_i
        if t[i] == c:
            count += 1
            i += 1
            longest = max(longest, count)
        else:
            i = base_i
            count = t[i] == c
            i += count

print(len(t)-longest)

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): # T検索の開始位置=その前にある文字数
        #print(T[j:i])
        t=T[j:i+j]
        p=S.find(t) # Sで見つかった場所
        if p!=-1:
            # print(j,i,t,p,j<=p,len(T)-i)
            if j<=p:
                break
    else:
        continue
    break
print(len(T)-i)

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:]:
            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 = str(input())
t = str(input())
cnt = 0
s_len = len(s)
t_len = len(t)
sa = s_len - t_len
Min = 9999999999999
for i in range(len(s) - len(t) - 1):
    ss = s[i:i+len(t)]
    cnt = 0
    for j in range(len(t)):
        if ss[j] == t[j]:
            cnt += 1
    Min = min(Min,len(t) - cnt)
    cnt = 0
print(Min)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
s = len(S)
t = len(T)

count = 0
max = 0

for i in range(s-t):
  for j in range(t):
    if S[j] == T[j]:
      count += 1
    if count > max:
      max = count
      count = 0
    else:
      count = 0

print(t-max)

Submission status: Wrong Answer

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

print(len(t)-maxans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
min_num = len(t)
tbd = 0
for i in range(0,len(s)-len(t)):
    for j in range(len(t)):
        if s[i:i+len(t)][j] != t[j]:
            tbd += 1
    if tbd <= min_num:
        min_num = tbd
    tbd = 0

print(min_num)

Submission status: Wrong Answer

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

s = input()
t = input()

ans = 10**5

len_s = len(s)
len_t = len(t)

S = []

for i in range(len_s):
    S.append(s[i])

for i in range(len_s - len_t):
    tmp = 0
    for j in range(len_t):
        if t[j] != S[i+j]:
            tmp += 1
    if tmp < ans:
        ans = tmp

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
if t in s: print(0)
else:
    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:
import difflib
import math

S = input()
T = input()

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

print(len(T) - all_min)

Submission status: Wrong Answer

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

def count():
    l = len(t)
    l2 = len(s)
    for count in range(l):
        for i in range(count+1):
            x = t[i:l-count+i]
            # print(count, x,s[i:l2-count+i])
            if x in s[i:l2-count+i]:
                return count
    return l
print(count())

Submission status: Wrong Answer

Solution code:
from collections import deque

def main():
    import sys
    input = sys.stdin.readline

    S = input()
    T = input()

    len_S = len(S)
    len_T = len(T)

    ans = 0
    for i in range(len_S - len_T +1):
        cnt = 0
        for j in range(len_T):
            if(S[i+j] == T[j]):
                cnt += 1
        ans = max(ans, cnt)
    print(len_T-ans)
if __name__ == '__main__':
    main()

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[:i] in s and len(t) - len(t[:i]) < min_v:
            min_v = len(t) - len(t[:i])

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

Submission status: Wrong Answer

Solution code:
def s():return input()
def mp():return map(int,input().split())
a =s()
b =s()
ans = ""
q,w =0,0
for i in range(len(b)):
	ans+=b[i]
	if ans in a[i:]:
		q+=1
	else:
		ans =""
		q =0
	w = max(w,q)
print(len(b)-w)

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
                print(i,j,cnt)
    if min < cnt:
        min = cnt
print(len(t)-min)

Submission status: Wrong Answer

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