Problem:


Score : 200 points

Problem Statement

Given are two strings S and T.

Let us change some of the characters in S so that T will be a substring of S.

At least how many characters do we need to change?

Here, a substring is a consecutive subsequence. For example, xxx is a substring of yxxxy, but not a substring of xxyxx.

Constraints

The lengths of S and T are each at least 1 and at most 1000.

The length of T is at most that of S.

S and T consist of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S
T

Output

Print the minimum number of characters in S that need to be changed.

Sample Input 1

cabacc
abc

Sample Output 1

1

For example, changing the fourth character a in S to c will match the second through fourth characters in S to T.

Since S itself does not have T as its substring, this number of changes - one - is the minimum needed.

Sample Input 2

codeforces
atcoder

Sample Output 2

6



Sample input:
cabacc
abc


Sample output:
1

Submission status: Wrong Answer

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

maxsame = 0

for i in range(len(s)-len(t)):
  same = 0
  for j in range(len(t)):
    if s[i+j] == t[j]:
      same += 1
    else:
      same = 0
    if same > maxsame:
      maxsame = same
    
print(len(t)-maxsame)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
min = len(S)
for i in range(len(S)-len(T)+1):
    count = 0
    for j in range(len(T)):
        if T[j] == S[i+j]:
            count += 1
    if min >= count and count != 0:
        min = count

if T in S:
    min = 0
print(min)

Submission status: Wrong Answer

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

flag = False
for i in range(l):
    k = l - i
    for j in range(i+1):
        a = t[j:k+j]
        if a in s:
            flag = True
            break
    if flag:
        break
print(i)

Submission status: Wrong Answer

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

tt = t

max_count = 0
while True:
    count = 0
    for i in range(len(t)):
        if s[i] == tt[i]:
            count += 1 
    # print(count)
    max_count = max(max_count, count)
    
    # print(f"{len(s)} {len(t)}")
    if len(s) == len(tt):
        break
    
    tt = ' ' + tt
    
print(len(t) - max_count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

if len(a) == 0:
  print(0)
else :
  print(min(a))

Submission status: Wrong Answer

Solution code:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    s = ns()
    t = ns()
    ans = len(t)
    for i in range(len(s) - len(t)):
        tmp = 0
        for j in range(len(t)):
            if s[i + j] == t[j]:
                tmp += 1
        ans = min(ans, len(t) - tmp)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math

S = input()
T = input()

ans = math.inf
for i in range(len(S) - len(T)):
    tmp = sum([s != t for s, t in zip(S[i:i + len(T)], T)])
    ans = min(ans, tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(map(str,input()))
t = list(map(str,input()))

same = 0

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

print(len(t) - same)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
ans = float('inf')
d = len(S) - len(T)

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

print(ans)

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:]:
            flag = 1
            print(i-1)
            break

if flag == 0:
    print(l)

Submission status: Wrong Answer

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


m = len(S)
for i in range(0,len(S)-len(T)+1):
    tgt = S[i:i+len(T)]
    if tgt != T:
        cnt = 0
        for j in range(len(tgt)):
            if tgt[j] != T[j]:
                cnt += 1
        m = min(cnt,m)

print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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)

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
num = 0
for i in range(len(s) - len(t) + 1):
    # a = s[i:]
    # print(a)
    cnt = 0
    for j in range(len(t)):
        if i + j >= len(t):
            continue
        if t[j] == s[i + j]:
            cnt += 1
    num = max(num, cnt)

print(len(t) - num)

Submission status: Wrong Answer

Solution code:
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    S = input()
    T = input()

    d = len(S) - len(T)
    ans = float("inf")
    for i in range(d):
        n = 0
        for j, t in enumerate(T):
            if S[i + j] != t:
                n += 1
        ans = min(ans, n)
    print(ans)


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 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
    ans = max(count, ans)
print(len(t)-ans)

Submission status: Wrong Answer

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

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

    ans = min(ans, tmp)

print(ans)

Submission status: Wrong Answer

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

slen=len(s)
tlen = len(t)
min = tlen

for i in range(slen - tlen):
    count = 0
    for j in range(tlen):
        if s[i + j] != t[j]:
            count += 1
    if count < min:
        min = count

print(min)

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
m = len(s)
l = len(t)
ans = m
for i in range(m-l):
  defe = 0
  for j in range(l):
    if t[j] != s[i+j]:
      defe += 1
  ans = min(defe, ans)
  
print(ans)

Submission status: Wrong Answer

Solution code:

def resolve():
    S = input()
    T =input()
    s_n  = len(S)
    t_n = len(T)

    ans = 2000
    for i in range(s_n - t_n):
        cnt = 0
        for j in range(t_n):
            if S[i+j] != T[j]:
                cnt += 1
        ans = min(ans, cnt)

    print(ans)

if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

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

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

print(len(t)-ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
SL = len(S)
TL = len(T)
ans = 1000
for i in range(SL - TL):
  count = 0
  for j in range(TL):
    if S[i+j] != T[j]:
      count += 1
  ans = min(ans,count)
print(ans)

Submission status: Wrong Answer

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

min=1000

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

print(sa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input().rstrip()
T = input().rstrip()
mn = len(T)
for i in range(len(S) - len(T)):
	n = 0
	for j in range(len(T)):
		if S[i + j] != T[j]:
			n += 1

	if n < mn:
		mn = n

print(mn)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

maxcount = 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
        maxcount = max(maxcount, count)
print(len(T) - maxcount)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    s = input()
    t = input()
    s_len = len(s)
    t_len = len(t)
    max_match = 0
    for k1 in range(s_len - t_len):
        match = 0
        for k2 in range(t_len):
            if s[k1+k2]==t[k2]:
                match+=1
        max_match = max(match, max_match)
    print(t_len - max_match)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

S = readline().strip()
T = readline().strip()

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

Submission status: Wrong Answer

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

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] in S[start:]:
            count = end - start
            max_count = max(max_count, count)

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
mx = float('-inf')
for i in range(0, len(s)-len(t)):
    # print(i)
    k = 0
    cnt = 0
    for j in t:
        # print(s[i], j)
        if s[i+k]==j:
            cnt+=1
            mx = max(cnt, mx)
        k+=1
print(len(t)-mx)

Submission status: Wrong Answer

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

def solve(S,T):
    i = 0
    for j in range(len(S)):
        if T[i] == S[j]:
            i += 1
            break
    
    return len(T) - i -1



print(solve(S,T))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

c = len(S) - len(T)

m = 1000
for i in range(c):
    count = 0
    for s, t in zip(S[i:], T):
        if s != t:
            count += 1
    m = min(m, count)
print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=str(input())
T=str(input())
min_count=len(T)
for i in range(len(S)-len(T)):
    count=0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            count+=1
    min_count=min(count,min_count)
print(min_count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
times = len(s) - len(t)
ans = 10000
if t in s:
  ans = 0
else:
  for i in range(times):
    ans_tmp = 0
    for j in range(len(t)):
      if t[j] != s[i+j]:
        ans_tmp += 1
    if ans_tmp <= ans:
      ans = ans_tmp
print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
ls = len(S)
lt = len(T)
ans = lt
for offset in range(ls - lt + 1):
	print(offset)
	cnt = 0
	for i in range(lt):
		print(S[offset+i], T[i])
		if S[offset + i] != T[i]:
			cnt += 1
	ans = min(ans, cnt)
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ans = len(t)

for i in range(len(s)-len(t)):
  si = s[i:i+len(t)]
  cnt = 0
  if len(si) == len(t):
    for sii, ti in zip(si, t):
      if sii != ti:
        cnt += 1
    ans = min(ans, cnt)
print(ans)

Submission status: Wrong Answer

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

for i in range(len(T), 0, -1):
    for j in range(len(T)-i):
        subst = T[j:i+j]
        if S.find(subst, j)>=0:
            print (len(T)-i)
            exit(0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s,t=open(0).read().split()
res=1001
for i in range(len(s)-len(t)):
  cnt=0
  for j in range(len(t)):
    if s[i+j]==t[j]:
      cnt+=1
  res=min(len(t)-cnt,res)
print(res)

Submission status: Wrong Answer

Solution code:
s=input()
l=input()
len_s=len(s)
len_l=len(l)
a=len_s-len_l
ans=1001
for i in range(len_s-len_l):
    cnt=0
    for j in range(len_l):
        if l[j]==s[i+j]:
            cnt+=1
    ans=min(ans,len_l-cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
ls = len(s)
lt = len(t)
ans = ls
for i in range(ls-lt-1):
    cnt = 0
    for j in range(lt):
        if s[i+j] != t[j]:
            cnt += 1
    ans = min(ans,cnt)
print(ans)

Submission status: Wrong Answer

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

    c = 0
    ans = len(t)
    for i in range(len(s)-len(t)):
        c = 0
        now = i
        for tt in t:
            if s[now] != tt:
                c += 1
            now += 1
        ans = min(ans,c)
    print(ans)
if __name__=='__main__':
    main()

Submission status: Wrong Answer

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

scnt = len(s)
tcnt = len(t)

change = 10**3

for i in range (0, scnt - tcnt):
  cnt = 0
  for j in range(tcnt):
    if s[i+j] != t[j]:
      cnt += 1
  if change > cnt:
    change = cnt

print(change)

Submission status: Wrong Answer

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

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 = INF
for i in range(len(s)-len(t)):
    now = 0
    for j in range(i, i+len(t)):
        if s[j] != t[j-i]:
            now += 1
    ans = min(ans, now)

print(ans)

Submission status: Wrong Answer

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

for i in range(0,ls-lt):
  cnt=0
  for ss,tt in zip(S[i:],T):
    if ss!=tt:
      cnt+=1
  
  if cnt<cnt2:
    cnt2=cnt

print(cnt2)

Submission status: Wrong Answer

Solution code:
import numpy as np
from copy import deepcopy
from heapq import heappop, heappush
from bisect import bisect_left, bisect
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations

S = input()
T = input()

replaced = S.replace(T, '')
print(len(S) - len(replaced))

exit()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-08-29 21:02:14 +0900
# LastModified: 2020-08-29 21:11:09 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    S = input()
    T = input()
    flag = 0
    for i in range(len(T), 0, -1):
        tmp = T[:i]
#        print("tmp:{}".format(tmp))
        if tmp in S:
            ans = len(T) - i
            flag = 1
            break
    if flag == 1:
        print(ans)
    else:
        S_T_and = list(set(S) & set(T))
        if S_T_and:
            print(len(T)-1)
        else:
            print(len(T))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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


s = input()
t = input()

result = len(t)

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

    if result > dif:
        result = dif

print(dif)

Submission status: Wrong Answer

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

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

print(len(T) - cnt)

Submission status: Wrong Answer

Solution code:
# B Subtring

S = input()
T = input()

if T in S:
  print(0)

for i in range(1, len(T)+1):
  if T[:-i] in S or T[i:] in S:
    print(i)
    exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = str(input())
T = str(input())
ans = 1000
for i in range(len(S) - len(T)):
    c = 0
    for j in range(len(T)):
        if S[i] != T[j]:
            c += 1
        i += 1
    ans = min(ans, c)
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

    print(res)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

max_cnt = 0
max_ind = 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
    max_cnt = max(max_cnt, cnt)
print(len(T) - max_cnt)

Submission status: Wrong Answer

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

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        for line in sys.stdin:
            lines.append(line.strip())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    s = lines[0]
    t = lines[1]

    return (s, t)


def solve(s, t):


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

        if cnt < count:
            count = cnt 


    return count


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

S = input()
T = input()

ans = float("Inf")

len_s = len(S)
len_t = len(T)

for i in range(len_s-len_t+1):
    _ans = 0
    for j in range(len_t):
        if S[i+j] != T[j]:
            _ans += 1
    ans = min(ans, _ans)

print(ans)

Submission status: Wrong Answer

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

b = len(s)
a = len(t)

min_cnt = 100000000

for i in range(b - a + 1):
    cnt = 0
    for j in range(a):
        if s[j+i] != t[j]:
            cnt += 1
    
    if min_cnt > cnt:
        min_cnt = cnt

print(cnt)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
assert len(S) <= 1000
assert len(T) <= 1000
assert len(T) <= len(S)
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:
s = list(input())
t = list(input())
ls = len(s)
lt = len(t)
ans = ls
for i in range(ls-lt):
    cnt = 0
    for j in range(lt):
        if s[i+j] != t[j]:
            cnt += 1
    ans = min(ans,cnt)
print(ans)

Submission status: Wrong Answer

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

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

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

common=longestSubstringFinder(s,t)
print(len(t)-len(common))

Submission status: Wrong Answer

Solution code:
import sys,math
from collections import deque,defaultdict
import operator as op
from functools import reduce

sys.setrecursionlimit(10**6) 

I=sys.stdin.readline

 #s="abcdefghijklmnopqrstuvwxyz"

"""
x_move=[-1,0,1,0,-1,1,1,-1]
y_move=[0,1,0,-1,1,1,-1,-1]
"""
def ii():
	return int(I().strip())
def li():
	return list(map(int,I().strip().split()))
def mi():
	return map(int,I().strip().split())

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer // denom

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x




	
def main():
	s=I()
	t=I()
	win=len(t)
	ans=999999
	for i in range(len(s)-win+1):
		x=0
		for j in range(win):
			if s[i+j]!=t[j]:
				x+=1
		ans=min(ans,x)
	print(ans)

			


	

























	
	
	





if __name__ == '__main__':
	main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ans = float("INF")
for i in range(len(S)-len(T)):
    cnt = len(T)
    for j in range(len(T)):
        if S[i+j] == T[j]:
            cnt -= 1
    ans = min(ans, cnt)

print(ans)

Submission status: Wrong Answer

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

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

ans = 10*4
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=len(T)
for i in range(len(T)):
    if T[:len(T)-i] in S:
        ans=i
        break
print(ans)

Submission status: Wrong Answer

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

ans = len(T)

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

Submission status: Wrong Answer

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

    slen = len(s)
    tlen = len(t)
    
    ans = 10 ** 10

    for i in range(slen - tlen):
        tmp = 0
        for j in range(tlen):
            if s[i+j] != t[j]:
                tmp += 1
        if ans > tmp:
            ans = tmp
    print(ans)




if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

min_count = t
for i in range(s - t):
    count = 0
    for j, tt in enumerate(T):
        if S[i: i + t][j] == tt:
            count += 1
    change = t - count
    if change < min_count:
        min_count = change
print(min_count)

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
ans=float("inf")
for i in range(len(S)-len(T)):
    tmp=0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            tmp+=1
    ans=min(ans,tmp)
print(ans) if ans<float("inf") else print(len(T))

Submission status: Wrong Answer

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

def count_common(a,b):
    cnt = 0
    for i in range(len(a)):
        if a[i] == b[i]:
            cnt += 1
    return cnt

cnt = 0

for i in range(len(S) - len(T) - 1):
    cnt = max(cnt, count_common(S[i:i+len(T)],T))

print(len(T)-cnt)

Submission status: Wrong Answer

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

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

cnt=0
max=0

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

print(T-max)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ans = 0
num = len(t)
temp1 = t
temp2 = t

while True:
    if (temp1 in s):
        print(ans)
        exit()
    if (temp2 in s):
        print(ans)
        exit()

    ans += 1
    if (num == ans):
        print(num)
        exit()

    temp1 = temp1[1:]
    tempnum = len(temp2)
    temp2 = temp2[:tempnum-1]
    #print(temp1, temp2)


print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
s = np.array(list(input()))
t = np.array(list(input()))

t_len = len(t)
chk_num = len(s) - t_len

change_num = t_len
for i in range(chk_num):
    tmp = t_len - np.count_nonzero(s[i: t_len + i] == t)
    change_num = min(tmp, change_num)

print(change_num)

Submission status: Wrong Answer

Solution code:
import sys,bisect

from sys  import stdin,stdout

from bisect import bisect_left,bisect_right,bisect,insort,insort_left,insort_right

from math import gcd,ceil,floor,sqrt

from collections import Counter,defaultdict,deque,OrderedDict

dx=[-1,1,0,0]
dy=[0,0,1,-1]


sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 998244353
mod = 10**9+7

def isPrime(n):
    if (n <= 1) :return False
    if (n <= 3) :return True
    if (n%2 == 0 or n%3 == 0):return False
    for i in range(5,ceil(sqrt(n))+1,6):
        if (n%i==0 or n%(i+2)==0):
            return False
    return True

def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")


def soe(limit):
    l=[1]*(limit+1)
    l[0]=0
    l[1]=0
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0
    
    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

                
def gcd(a,b):
    while b:
        a=a%b
        b,a=a,b
    return a

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r
    
def solve():
    s=input()
    t=input()
    ans=float('inf')
    i=0
    while i<len(s)-len(t):
        x=0
        c=0
        j=i
        
        while x<len(t):
            #print(s[x],t[i+x])
            if t[x]!=s[i+x]:
                c+=1
            j+=1
            x+=1
        
        ans=min(ans,c)
        i+=1
    print(ans)
        


for _ in range(1):
    solve()

Submission status: Wrong Answer

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

maxS = 0
for i in range(len(s) - len(t)):
    simC = 0
    for ind,j in enumerate(s[i:i + len(t)]):
        if t[ind] == j:
            simC += 1
    if simC>maxS:
        maxS = simC
print(len(t) - maxS)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(len(t)):
    for j in range(i, len(t)):
        if t[i:j] in s[i:]:
            max_len = max(max_len, j-i)

print(len(t) - max_len)

Submission status: Wrong Answer

Solution code:
import math


def distance(s, t):
    assert len(s) == len(t)

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

    return cnt


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

    dist = float('inf')

    for i in range(len(S) - len(T)):
        dist = min(dist, distance(S[i:i+len(T)], T))

    print(dist)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 100000
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

s = X()
t = X()


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

print(cnt)