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:
#one, two, three, four, five = map(int, input().split())
#li = list(map(int, input().split()))
def Levenshtein(str1,str2):
  count = 0
  for i in range(len(str1)):
    if str1[i] != str2[i]:
      count += 1
  return count

if __name__ == '__main__':
    S = input()
    T = input()
    min_ = 9999999
    for i in range(len(S)-len(T)):
      str1 = S[i:i+len(T)]
      str2 = T
      #print(str1,str2)
      leven = Levenshtein(str1,str2)
      if(leven < min_):
        min_ = leven
    print(min_)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
S = [c for c in s]
T = [c for c in t]
m = len(T)
for i in range(len(S)-len(T)-1):
  temp = 0
  for j in range(i,i+len(T)):
    if S[j] != T[j-i]:
      temp += 1
  if temp<m:
    m=temp
print(m)

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
a=len(S)
b=len(T)
m=a-b
A=[]
if m!=0:
    for i in range(m):
        cnt=b
        for j in range(b):
            if S[i+j]==T[j]:
                cnt-=1
        A.append(cnt)
else:
    for i in range(a):
        cnt=b
        if S[i]==T[i]:
            cnt-=1
    A.append(cnt)
print(min(A))

Submission status: Wrong Answer

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

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

print(len(T)-num_char)

Submission status: Wrong Answer

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

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


print(ans)

Submission status: Wrong Answer

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

ans = len(s)

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

print(ans)

Submission status: Wrong Answer

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

res = 0
for i in range(len(S)-len(T)):
    cnt = 0
    for j in range(len(T)):
        if S[j+i] == T[j]:
            cnt += 1
            res = max(res, cnt)
        else:
            cnt = 0
    res = max(res, cnt)
print(len(T) - res)

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
Max = 0
for i in range(sa):
    ss = s[i:i+len(t)]
    for j in range(len(t)):
        if ss[j] == t[j]:
            cnt += 1
    Max = max(Max,cnt)
    cnt = 0
print(len(t) - Max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

L = 0
judge = False

for i in range(len(T), 0, -1):
    # print(i)
    for j in range(len(T)-i+1):
        # print(S[j:])
        if T[j:j+i] in S[j:]:
            L = i
            # print(T[j:j+i])
            judge = True
            # print(i, j)
            break
    if judge:
        break

print(len(T)-L)

Submission status: Wrong Answer

Solution code:
import sys, io, os, re
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from pprint import pprint
from math import sin, cos, pi, radians, sqrt, floor, ceil
from copy import copy, deepcopy
from collections import deque, defaultdict
from fractions import gcd
from functools import reduce
from itertools import groupby, combinations
from heapq import heapify, heappush, heappop

# sys.setrecursionlimit(5000)

n1 = lambda: int(sys.stdin.readline().strip())
nn = lambda: list(map(int, sys.stdin.readline().strip().split()))
f1 = lambda: float(sys.stdin.readline().strip())
fn = lambda: list(map(float, sys.stdin.readline().strip().split()))
s1 = lambda: sys.stdin.readline().strip()
sn = lambda: list(sys.stdin.readline().strip().split())
nl = lambda n: [n1() for _ in range(n)]
fl = lambda n: [f1() for _ in range(n)]
sl = lambda n: [s1() for _ in range(n)]
nm = lambda n: [nn() for _ in range(n)]
fm = lambda n: [fn() for _ in range(n)]
sm = lambda n: [sn() for _ in range(n)]

def array1(n, d=0): return [d] * n
def array2(n, m, d=0): return [[d] * m for x in range(n)]
def array3(n, m, l, d=0): return [[[d] * l for y in xrange(m)] for x in xrange(n)]
def linc(A, d=1): return list(map(lambda x: x + d, A))
def ldec(A, d=1): return list(map(lambda x: x - d, A))

S = s1()
T = s1()

m = 10**6
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 m > cnt:
        m = cnt

print(m)

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout
from collections import Counter,deque
import math
cin = stdin.readline
cout = stdout.write
def inpn():
    return(int(cin()))
def inpl():
    return(list(map(int,cin().split())))
def inps():
    return cin()[:-1]
def inpv():
    return (map(int, cin().split()))
def outs(s):
    cout(s)
def outn(n):
    cout(str(n))
def outl(l):
    for i in l:
        cout(str(i)+" ")
def outb(s):
    cout(str(s))


# n = inpn()
# l=inpl()
# m=1000000007
# add=0
# for i in range(n-1):
#     for j in range(i+1,n):
#         add+=(l[i]%m*l[j]%m)%m
#
# outn(add%m)
# cout("\n")

s=inps()
t=inps()
ans=1000
if t in s:
    outn(0)
    cout("\n")
else:
    for i in range(len(s)-len(t)):
        count=0
        for j in range(len(t)):
            if s[i+j]!=t[j]:
                count+=1
        ans=min(ans,count)
    outn(ans)
    cout("\n")

Submission status: Wrong Answer

Solution code:
ans = 1000
hoge = 0

s = input()
t = input()

sl = len(s)
tl = len(t)
for i in range(sl-tl+1):
    hoge = 0
    for j in range(tl):
        if s[i+j] != t[j]:
            hoge = hoge + 1
    if hoge == 0:
        ans = 0
        break
    if ans > hoge:
        ans = hoge

if ans == 1000:
    print("0")
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ans = 1000
for i in range(len(s) - len(t)):
    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)
print(ans)

Submission status: Wrong Answer

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

max_count = 0
for start in range(len(T)):
    for end in range(start, len(T)):
        if T[start:end+1] in S[start:]:
            max_count = max(max_count, len(T[start:end+1]))

answer = len(T) - max_count
print(answer)

Submission status: Wrong Answer

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

c_min=len(t)

for i in range(len(s)+1-len(t)):
    count=len(t)
    for n in range(len(t)):
        if s[i+n] == t[n]:
            count -=1
        elif s[i+n] != t[n]:
            break
    for n in range(len(t)):
        if s[i+len(t)-1-n] ==t[len(t)-1-n]:
            count-=1
        else:
            break
    if count < c_min:
        c_min =count
        
print(c_min)

Submission status: Wrong Answer

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

cnt = 0
for i in range(len(S)):
    tmp = 0
    for j in range(len(T)):
        if i + j < len(S) and S[i + j] == T[j]:
            tmp += 1
        else:
            cnt = max(cnt, tmp)
            tmp = 0
    cnt = max(cnt, tmp)

print(len(T) - cnt)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
present_len = 10000
curr_len = 0
s_len = len(s)
t_len = len(t)
t_chars = list(t)
for i in range(0, (s_len - t_len)):
    j = i
    curr_len = 0
    for k in range(t_len):
        if s[j] != t[k]:
            curr_len += 1
        j += 1
    present_len = min(present_len, curr_len)
print(present_len)

Submission status: Wrong Answer

Solution code:
#!/usr/bin python3
# -*- coding: utf-8 -*-

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

def cnt(a,b):
    ret = 0
    for i in range(len(a)):
        ret += a[i]!=b[i]
    return ret

ans = 1000
for i in range(sl-tl):
    ans = min(ans, cnt(s[i:i+tl], t))
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
if t in s:
  print(0)
else:
  for i in range(len(t)-1):
    i += 1
    t1 = t[:i]
    t2 = t[i:]
    if t2 in s:
      print(i)
      break
    i *= -1
    t3 = t[i:]
    t4 = t[:i]
    if t4 in s:
      print(i*-1)
      break
  print(len(t))

Submission status: Wrong Answer

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

lent = len(T)
ans = lent
for i in range(len(S)-lent):
    s = S[i:i+lent]
    lev = 0
    lev = sum(map(lambda x: x[0] != x[1], zip(s, T)))
    if lev == 0:
        ans = 0
        break
    elif lev < ans:
        ans = lev
print(ans)

Submission status: Wrong Answer

Solution code:
S=str(input())
T=str(input())
ss=len(S)
tt=len(T)
nax=0
ans=0
for i in range(ss-tt):
    for j in range(tt):
        if S[i+j]==T[j]:
            ans+=1
    nax=max(nax,ans)
    ans=0

print(tt-nax)

Submission status: Wrong Answer

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

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

if ans == 0:
    ans = len(t)

print(len(t) - ans)

Submission status: Wrong Answer

Solution code:
def main():
    import copy
    S = str(input())
    T = str(input())
    ans = 0
    temp = 0

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

    ans = len(T) - temp
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

num_char=0
for i in range(len(T)):
    for j in range(i+1,len(T)):
        if T[i:j] in S[i:]:

            if num_char<j-i:
                num_char=j-i
print(len(T)-num_char)

Submission status: Wrong Answer

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

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

longest = 0
for i in range(t_len):
  for j in range(i, t_len+1):
    word = T[i:j]
    if word in S[i:] and len(word) > longest:
      longest = len(word)

print(str(t_len - longest))

Submission status: Wrong Answer

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

for i in range(l):
    print(t[i:])
    if t[i:] in s:
        a = i
        break
else:
    a = l

for j in range(1, l):
    print(t[:l-j])
    if t[:l-j] in s:
        b = j
        break
else:
    b = l

print(min(a, b))

Submission status: Wrong Answer

Solution code:
def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]
ans = 0

s = input()
t = input()
l = len(t)

mx = 0
if len(s) < l:
    mx = 0
    for a, b in zip(s, t):
        if a == b: mx += 1
else:
    for idx, _ in enumerate(s[:-l+1]):
        word = ''
        for i in range(l):
            word += s[idx+i]
        x = 0
        for a, b in zip(word, t):
            if a == b: x += 1
        if x > mx: mx = x

ans = l - mx

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
f, b = t[::], t[::]
cnt = 0
while True:
    if s.find(f) == -1 and s.find(b) == -1:
        cnt += 1
        f = f[:-1]
        b = b[1:]
    else:
        break
print(cnt)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ans = 1000
for i in range(0,len(s)-len(t)):
  cnt = 0
  for (m,n) in zip(s[i:i+len(t)],t):
    if m!=n : cnt += 1
  ans = min(ans,cnt)
  
print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
ans = 1e9

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

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
max = 0
for i in reversed(range(len(t)+1)):
    for j in range(len(t)-i+1):
#         print(i, j)
#         print(t[j:i+j])
        if t[j:i+j] in s[j:] and i >= max:
            max = i
#         print(f'max:{max}')

print(len(t) - max)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
ans=10*3+1
for i in range(len(s)-len(t)+1):
    tmp=0
    for j in range(len(t)):
        # print(s[i+j],t[j])
        if s[i+j]!=t[j]:
            tmp+=1
    ans=min(ans,tmp)
    # print("-"*10)
print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

c = 0
u = []
for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if t[j]!=s[j+i]:
            c+=1
    u.append(c)
print(min(u))

Submission status: Wrong Answer

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

    min_change = 1e5
    for i in range(len(S)-len(T)+1):
        tmp_change = 0
        for j in range(len(T)):
            if S[i+j] != T[j]:
                tmp_change += 1
        min_change = min(min_change, tmp_change)

    if len(S) == len(T) and S != T:
        min_change = len(T)

    print(min_change)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
assert 1 <= len(S) and len(S) <= 1000
assert 1 <= len(T) and len(T) <= 1000
assert len(T) <= len(S)
for s in S:
    assert s.islower()
for t in T:
    assert t.islower()
len_T = len(T)
max_count = 0
for i in range(len(S)-len_T):
    count = 0
    for j in range(len_T):
        count += int(T[j] == S[i+j]) 
    max_count = max(count, max_count)
print(len_T - max_count)

Submission status: Wrong Answer

Solution code:
# B Subtring

S = input()
T = input()

ans = 10000
for s in range(len(S) - len(T)):
  cnt = 0
  for t in range(len(T)):
    if S[s+t] != T[t]:
      cnt += 1
  ans = min(ans, cnt)

print(ans)

Submission status: Wrong Answer

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

ans=len(T)

itti=0
for i in range(len(S)-len(T)):
    cnt=0
    for j in range(i,i+len(T)):
        if S[j]==T[j-i]:
            cnt+=1
    itti = max(itti,cnt)

print(len(T)-itti)

Submission status: Wrong Answer

Solution code:
import math
import sys,collections
from sys import stdin, stdout  
#MAXN = 10000001

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_string(): return sys.stdin.readline().strip() 
def input(): return sys.stdin.readline().strip()
#spf = [0 for i in range(MAXN)] 
def file():
	sys.stdin = open('input.py', 'r')
	sys.stdout = open('output.py', 'w') 
def is_subsequence(x, y):
    """Test whether x is a subsequence of y"""
    x = list(x)
    for letter in y:
        if x and x[0] == letter:
            x.pop(0)

    return not x    
def sieve(): 
	spf[1] = 1
	for i in range(2, MAXN): 
		spf[i] = i 
	for i in range(4, MAXN, 2): 
		spf[i] = 2

	for i in range(3, mt.ceil(mt.sqrt(MAXN))): 
		if (spf[i] == i): 
			for j in range(i * i, MAXN, i): 
				if (spf[j] == j): 
					spf[j] = i 
def getFactorization(x): 
	ret = list() 
	while (x != 1): 
		ret.append(spf[x]) 
		x = x // spf[x] 

	return ret 
def getFloor(A, x):

    (left, right) = (0, len(A) - 1)

    ind,floor = -1,-1
    while left <= right:
        mid = (left + right) // 2
        '''if A[mid] == x:
            return mid'''
        if x < A[mid]:
            right = mid - 1
        else:
            floor = A[mid]
            ind=mid
            left = mid + 1
            
    return ind
def check(st) : 
  
    # Compute sum of digits 
    n = len(st) 
    digitSum = 0
      
    for i in range(0,n) : 
        digitSum = digitSum + (int)(st[i]) 
  
    # Check if sum of digits 
    # is divisible by 9. 
    return (digitSum % 9 == 0)     
def isPowerOfTwo(n): 
    if (n == 0): 
        return False
    while (n != 1): 
            if (n % 2 != 0): 
                return False
            n = n // 2
            
              
    return True
def kitte(n):
	c=0
	while(n!=0):
		n=n//2
		c+=1
	return c	
def aa(b,c):
	m=min(b,c)
	b-=m
	c-=m
	if(c>0 and b>0):
		return(m+((b+c)//3))
	else:
		return(m)
def bb(a,c):
	m=min(a,c)
	a-=m
	c-=m
	if(c>0 and a>0):
		return(m+((a+c)//3))
	else:
		return(m)
def cc(b,a):
	m=min(b,a)
	b-=m
	a-=m
	if(a>0 and b>0):
		return(m+((b+a)//3))
	else:
		return(m)		
#file()
#sieve() 
mod=(10**9)+7	
def main():
	s=input()
	t=input()
	m=float('inf')
	ans=[]
	for i in range(len(s)-len(t)+1):
		c=0
		ind=i
		for j in range(len(t)):
			#print(s[ind],t[j])
			if(s[ind]==t[j]):
				c+=1
			ind+=1	
		#print(c)
	ans.append(c)
	print(len(t)-max(ans))	


	



	

	
			


		




		






		







			



	

	




	





















	




















		
			


		

			

		





			

	























				

	















	

	










if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding: utf-8

S = input()
T = input()

match = len(T) 
for i in range(len(S) - len(T)):
    cand = len(T)
    for j in range(len(T)):
        if S[i+j] == T[j]:
            cand -= 1
    match = min(cand, match)

print(match)

Submission status: Wrong Answer

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

S= input().rstrip('\n')
T= input().rstrip('\n')
res = 0
check = 0
for x in range(len(T),0,-1):
  for i in range(len(T)-x):
    l = len(T)-i-x-1
    if T[i:i+x] in S[i:len(S)-l]:
      res += len(T)-x
      check += 1
      break
  if check>0:
    break
print(res)

Submission status: Wrong Answer

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

minChangeCounter = 1000000

for i in range(len(S) - len(T)):
    substr = S[i:i + len(T)]
    changeCounter = 0
    for j in range(len(T)):
        if not substr[j] == T[j]:
            changeCounter += 1
    if changeCounter < minChangeCounter: minChangeCounter = changeCounter

print(minChangeCounter)

Submission status: Wrong Answer

Solution code:
import re
import itertools
import sys
S = input()
T = input()
t = len(T)
for i in range(t): 
    a = itertools.combinations(range(t),i)
    for j in a:
        TT = list(T)
        for jj in j:
            TT[jj] ="."
        TTT = "".join(TT)
        b = re.compile(TTT)
        c = re.search(b,S)
        if c:
            print(i)
            sys.exit()

Submission status: Wrong Answer

Solution code:
input_list = [input() for i in range(2)]
M = len(input_list[0])
N = len(input_list[1])


ans = 0

for i in range(M-N+1):

    num = 0

    substring = input_list[0][i:i+N]

    for j in range(len(substring)):

        if substring[j] != input_list[1][j]:

            num += 1

    ans = num

print(ans)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    S = input()
    T = input()
    ans = len(T)
    for i in range(len(S)-len(T)):
        cnt = 0
        for j in range(len(T)):
            if T[j] != S[i+j]:
                cnt += 1
        ans = min(ans, cnt)
    print(ans)

Submission status: Wrong Answer

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

flag=False

m=0

for i in range(len(s)-len(t)+1):
  cnt=0
  for j in range(len(t)):
    #print(s[i+j],t[j])
    if s[i+j]==t[j]:
      cnt+=1
      flag=True
    else:
      if flag==True:
        if m==0 or m<cnt:
          m=cnt
        cnt=0
        flag=False

print(len(t)-m)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    a, b = input(), input()
    min = 1e10
    for i in range(len(a) - len(b)):
        c = 0
        for j in range(len(b)):
            if a[i + j] != b[j]:
                c += 1
        if c < min:
            min = c
    print(min)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
if t in s:
  print(0)
else:
  for i in range(len(t)-1):
    i += 1
    t1 = t[:i]
    t2 = t[i:]
    if t2 in s:
      print(i)
      break
    i *= -1
    t3 = t[i:]
    t4 = t[:i]
    if t4 in s:
      print(t3,t4)
      print(i*-1)
      break
  print(len(t))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def getCommonCharNum(x, y):
    commonCharNum = 0
    for i in range(len(x)):
        if x[i] == y[i]:
            commonCharNum += 1
    return commonCharNum

for i in range(len(s) - len(t) + 1):
    maxCommon = 0
    tmpCommonCharNum = getCommonCharNum(s[i: len(t) + i], t)
    if maxCommon < tmpCommonCharNum:
        maxCommon = tmpCommonCharNum
print(len(t) - maxCommon)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def resolve():
    all_string = input()
    target_string = input()
    all_length = len(all_string)
    target_length = len(target_string)
    max_count = -1
    for i in range(all_length - target_length + 1):
        count = 0
        part_string = all_string[i:target_length]
        for s1, s2 in zip(part_string, target_string):
            if s1 == s2:
                count +=1
        if count>max_count:
            max_count = count
    print(target_length - max_count)
resolve()

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
ls = len(S)
lt = len(T)

ans = 10000
for i in range(ls - lt):
    S1 = S[i: i+lt]
    cnt = 0
    for j in range(lt):
        if S1[j] == T[j]:
            cnt += 1
    ans = min(ans, lt-cnt)

print(ans)

Submission status: Wrong Answer

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

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

ans = 1000
for i in range(len_s - len_t):
    cnt = 0
    for j in range(len_t):
        if s[i + j] == t[j]:
            cnt += 1
        else:
            ans = min(ans, len_t - cnt)
            continue

print(ans)

Submission status: Wrong Answer

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

for i in range(len(t)):
    if t[:len(t)-i] in s:
        print(i)
        exit()

print(0)

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
ans,i = len(t),0
while i < len(s):
    res,k = 0,i
    if i+len(t) >= len(s):
        break
    for j,cc in enumerate(t):
        if s[k] != t[j]:
            res += 1
        k += 1
    ans = min(ans,res)
    i += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout
from collections import Counter,deque
import math
cin = stdin.readline
cout = stdout.write
def inpn():
    return(int(cin()))
def inpl():
    return(list(map(int,cin().split())))
def inps():
    return cin()[:-1]
def inpv():
    return (map(int, cin().split()))
def outs(s):
    cout(s)
def outn(n):
    cout(str(n))
def outl(l):
    for i in l:
        cout(str(i)+" ")
def outb(s):
    cout(str(s))


# n = inpn()
# l=inpl()
# m=1000000007
# add=0
# for i in range(n-1):
#     for j in range(i+1,n):
#         add+=(l[i]%m*l[j]%m)%m
#
# outn(add%m)
# cout("\n")

s=inps()
t=inps()
ans=1000
if t in s:
    outn(0)
    cout("\n")
else:
    for i in range(len(s)-len(t)):
        count=0
        for j in range(len(t)):
            if s[i+j]!=t[j]:
                count+=1
        ans=min(ans,count)
    outn(ans)
    cout("\n")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
a=0
for i in range(len(t)):
  if s.count('t[i]')<1:
    a+=1
print(a)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
 
# t, s = map(str,input().split())

s = input()
t = input()

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

        min_change = min(min_change, change)

print(min_change)

Submission status: Wrong Answer

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

result = 10**5
for i in range(len(S) - len(T) + 1):
    cnt = 0
    for s, t in zip(S[i: (i + lt)], T):
        if s != t:
            cnt += 1
    result = max(cnt, result)
print(result)

Submission status: Wrong Answer

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

max_len = 0
for left in range(len(T)):
    for right in range(left, len(T)):
        tmp = T[left:right]
        tmpS = S[left:-(len(T) - right)]
        # print(tmp, tmpS)
        if tmp in tmpS:
            max_len = max(len(tmp), max_len)

print(len(T) - max_len)

Submission status: Wrong Answer

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

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

def f(s1,s2):
  print(s1, s2)
  r=0
  for i,j in zip(s1,s2):
    if i != j: r += 1
  return r

a=len(S)
for i in range(len(S)-len(T)+1):
  r = f(S[i:i+len(T)],T)
  if a > r: a = r

print(a)

Submission status: Wrong Answer

Solution code:
#B
S = input()
T = input()
def counter(A,B):
    tmp = 0
    for j in range(len(A)):
        if A[j]==B[j]:
            tmp += 1
    return tmp
result = 0
if S == T:
    result = len(T)
else:
    for i in range(len(S)-len(T)):
        if counter(S[i:i+len(T)],T) > result:
            result = counter(S[i:i+len(T)],T)
print(len(T)-result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s1 = input()
s2 = input()

i = 0
j = len(s2)
m = len(s2)
while j < len(s1):
  c = 0
  for k in range(len(s2)):
    if s2[k] == s1[k+i]:
      c+=1
  j += 1
  i += 1
  m = min(m, len(s2)-c)

print(m)

Submission status: Wrong Answer

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

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

ans = 10*5
for i in range(len_S - len_T+1):
    num = 0
    tmp = S[i:i+len_T]
    for j in range(len(tmp)):
        if tmp[j] != T[j]:
            num+=1
    ans = min(ans, num)

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ans = ''
for i in range(len(t)):
  k = len(t) - i
  if ans == '':
    for j in range(len(s) - k + 1):
      if s[j: j + k] in t and j > t.index(s[j:j + k]) and len(s) - j - k >= len(t) - t.index(s[j:j + k]) - k:
        ans = len(t) - k
        break      
print(ans)

Submission status: Wrong Answer

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

result = 0
for i in range(len(s)):
  count = 0
  flg = False
  for j in range(len(t)):
    if i+j > len(s)-1:
      break
    if t[j] == s[i+j]:
      flg = True
    else:
      flg = False

    if flg:
      count += 1
      
  result = max(result,count)
print(len(t)-result)

Submission status: Wrong Answer

Solution code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


s = S()
t = S()
ans = len(t)
for i in range(len(s)-len(t)):
    # print(f'{i=}')
    now = 0
    for j in range(len(t)):
        # print(f'{(s[i+j], t[j])=}')
        if s[i+j] != t[j]:
            now += 1
    # print(f'{now=}')
    ans = min(ans, now)

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
a=len(s)
b=len(t)
ans=1001
kari=0
for i in range(0,a-b):
    c=s[i:b+i]
    kari=0
    k=0
    for j in range(b):
        if t[j]!=c[j]:
            kari+=1
      
    if ans>kari:
        ans=kari
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ans = 0
max = 0

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

Submission status: Wrong Answer

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

flag=False

m=0

for i in range(len(s)-len(t)):
  cnt=0
  for j in range(len(t)):
    #print(s[i+j],t[j])
    if s[i+j]==t[j]:
      cnt+=1
      flag=True
    else:
      if flag==True:
        if m==0 or m<cnt:
          m=cnt
        cnt=0
        flag=False

print(len(t)-m)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
m = 0
for i in range(len(T)):
  for j in range(i+1,len(T)+1):
       if T[i:j] in S:
            ind = S.index(T[i:j])
            if ind >= i and len(S)-ind >= len(T[i:]):
              #print(T[i:j], ind)
              m = max(m,len(T[i:j]))
print(len(T)-m)