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: Runtime Error

Solution code:
import sys

input = sys.stdin.readline



S = input()
T = input()

S = S.replace('\n','')
T = T.replace('\n','')

s_list = list(S)
t_list = list(T)

itti = 0
max_itti = 0
for s in s_list:
    if s == t_list[itti]:
        itti += 1
        max_itti = max(max_itti,itti)
    else:
        itti = 0
flag = False

if max_itti == 0:
    for s in s_list:
        for t in t_list:
            if s == t:
                max_itti = 1
                flag = True
            if flag:
                break
        if flag:
            break
                

print(len(t_list) - max_itti)

Submission status: Runtime Error

Solution code:
import sys

input = sys.stdin.readline



S = input()
T = input()

s_list = list(S)
s_list = s_list[:-1]
t_list = list(T)
t_list = t_list[:-1]

itti = 0
max_itti = 0
for s in s_list:
    if s == t_list[itti]:
        itti += 1
        max_itti = max(max_itti,itti)
    else:
        itti = 0
flag = False

if max_itti == 0:
    for s in s_list:
        for t in t_list:
            if s == t:
                max_itti = 1
                flag = True
            if flag:
                break
        if flag:
            break
                

print(len(t_list) - max_itti)

Submission status: Runtime Error

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

def d(s,t):
  return sum([1 if i!=j else 0 for i,j in zip(s,t)])

print(min([d(S[i:], T) for i in range(len(S)-len(T))]))

Submission status: Runtime Error

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

s_len = len(s)
t_len = len(t)

count=0

for i in range(t_len):
    for j in range:
        if t[j:j+t_len-i] in s:
            break
        else:
            continue
    count += 1

print(count)

Submission status: Runtime Error

Solution code:
s = input()
t = input()
ls = len(s)
lt = len(t)

ans = 0
for i in range(ls-lt+1):
  same = 0
  for j in range(lt):
    ind = i+lt
    if s[ind]==t[j]:
      same += 1
  ans = min(ans,min)
print(ans)

Submission status: Runtime Error

Solution code:
S = input()
T = input()
lS = len(S)
lT = len(T)
C = []
for i in range(lS-lT):
    count = 0
    for j in range(lT):
        if S[i+j]!=T[j]:
            count += 1
    C.append(count)
print(min(C))

Submission status: Runtime Error

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[i + j]:
            count += 1
    a.append(count)
print(len(t)-max(a))

Submission status: Runtime Error

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[i + j]:
            count += 1
    a.append(count)
print(len(t)-max(a))

Submission status: Runtime Error

Solution code:
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

s = input()
t = input()

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

Submission status: Runtime Error

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


ans = [len(T) -1]
for i in range(len(S)):
  if S[i] == T[0]:
    s = 0
    for j in range(1,len(T)):
      if S[i + j] == T[j]:
        pass
      else:
        s += 1
    ans.append(s)

print(min(ans))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
s=input()
t=input()
ans=len(t)
j=0
a=[len(t)-1]
for i in range(len(s)-1):
               
    if t[j]==s[i]:       
        ans-=1
        j+=1
        a.append(ans)
    if j==len(t)-1:
        j=0    
        ans=len(t)
    
print(min(a))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

def match_num_character(x, y):
  count = 0
  for a, b in zip(x, y):
    if a == b:
      count += 1
      
  return count

length = len(T)
max_count = max([match_num_character(S[i:i+length], T) for i in range(len(S) - length)])

print(length - max_count)

Submission status: Runtime Error

Solution code:
a = input()
b = input()
ind = []
for i in range(len(a)-len(b)):
  if a[i] == b[0]:
    ind.append(i)

ans = len(b)
for i in range(i):
  count = 0
  for j in range(len(b)):
    if a[i+j]!=b[j]:
      count += 1
  ans = min(ans,count)

print(ans)

Submission status: Runtime Error

Solution code:
# import math
# import statistics
a=input()
b=input()
#b,c=int(input()),int(input())
c,d=[],[]
for i in a:
    c.append(i)
for i in b:
    d.append(i)
#e1,e2 = map(int,input().split())
# f = list(map(int,input().split()))
#g = [input() for _ in range(a)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))
ma=[]
if b in a:
    print(0)
else:
    for i in range(len(c)-len(d)+1):
        count=0
        for k in range(len(d)):
            if c[i:len(d)+i][k]!=d[k]:
                count+=1
        ma.append(count)

print(min(ma))

Submission status: Runtime Error

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

ans = 0
for i in range(s-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)

Submission status: Runtime Error

Solution code:
s=input()
t=input()
L=len(s)
l=len(t)
X=[]
for i in range(L-l):
    x=0
    for j in range(l):
        if s[i+j]!=t[j]:
            x+=1
    X.append(x)
print(min(X))

Submission status: Runtime Error

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

ans = []
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.append(count) 

print(min(ans))

Submission status: Runtime Error

Solution code:
S=list(input())
T=list(input())
A=[]
for i in range(len(S)-len(T)):
    B=0
    for j in range(len(T)):
        if T[j]==S[i+j]:
            continue
        else:
            B =B+1
    A.append(B)

A.sort()
print(A[0])

Submission status: Runtime Error

Solution code:
S=input()
T=input()
ANS=[]
for start in range(len(S)-len(T)):
  ans = 0
  for j in range(len(T)):
    if S[start+j] != T[j]:
      ans += 1
  ANS.append(ans)
print(min(ANS))

Submission status: Runtime Error

Solution code:
S=input()
T=input()
ANS=[]
for start in range(len(S)-len(T)):
  ans = 0
  for j in range(len(T)):
    if S[start] != T[j]:
      ans += 1
  ANS.append(ans)
print(min(ANS))

Submission status: Runtime Error

Solution code:
for i in range(len(S)-lenT+1):
  compareS = S[i:i+lenT]
  match_len = 0
  for j in range(lenT):
    if compareS[j] == T[j]:
      match_len += 1
  else:
    if max_match_len < match_len:
      max_match_len = match_len
print(lenT - max_match_len)

Submission status: Runtime Error

Solution code:
Sr = input()
Tg = input()

ans = 10000
for i in range(len(Sr)-len(Tg)+1):
  mat = 0
  trimmedSr = Sr[i:i + len(Tg)]
  for j in range(len(Tg)):
    if trimmedSr != Tg[j]:
      mat++;
  ans = min(mat, ans)
print(ans)

Submission status: Runtime Error

Solution code:
def compare(a,b):
  res = 0
  for x,y in zip(a,b):
    if x == y:
      res += 1
  return res

s,t = map(int, input().split())
len_t = len(t)
ans = 0
for i in range(len(s)-len(t)+1):
  ans = max(ans,compare(s[i:i+len_t],t))
print(ans)

Submission status: Runtime Error

Solution code:
def compare(a,b):
  res = 0
  for x,y in zip(a,b):
    if x == y:
      res += 1
  return res

s,t = map(int, input().split())
len_t = len(t)
ans = 0
for i in range(len(s)-len(t)+1):
  ans = max(ans,compare(s[:i+len_t],t))
print(ans)

Submission status: Runtime Error

Solution code:
def compare(a,b):
  res = 0
  for x,y in zip(a,b):
    res += 1 if x == y
  return res

s,t = map(int, input().split())
len_t = len(t)
ans = 0
for i in range(len(s)-len(t)+1):
  ans = max(ans,compare(s[:i+len_t],t))
print(ans)

Submission status: Runtime Error

Solution code:
strS = input()
strT = input()

maxRange = 0
l = 0
while l <= (len(strS)-len(strT)):
    m = 0
    count = 0
    while m <= (len(strT)):
        if strS[l+m] != strT[m]:
            count += 1
        m += 1
    if maxRange > count:
        maxRange = count
    l += 1
print(maxRange)

Submission status: Runtime Error

Solution code:
strS = input()
strT = input()

maxRange = 0
l = 0
while l <= (len(strS)-len(strT)):
    m = 0
    count = 0
    while m <= (len(strT)):
        if strS[l+m] == strT[m]:
            count += 1
        m += 1
    if maxRange < count:
        maxRange = count
    l += 1
print(len(strT)-maxRange)

Submission status: Runtime Error

Solution code:
strings = input().splitlines()

strS = list(strings[0])
strT = list(strings[1])

maxRange = 0
l = 0
while l < (len(strS)-len(strT)):
    m = 0
    count = 0
    while m < (len(strT)):
        if strS[l+m] == strT[m]:
            count += 1
        m += 1
    if maxRange < count:
        maxRange = count
    l += 1
print(len(strT)-maxRange)

Submission status: Runtime Error

Solution code:
strings = input().splitlines()

# 一致している数の最大値を取得する。
# そして、その一致している数と、Tの数を比較する。足りない文字数を補うと良い

strS = list(strings[0])
strT = list(strings[1])

maxRange = 0
l = 0
while l < (len(strS)-len(strT)):
    m = 0
    count = 0
    while m < (len(strT)):
        if strS[l+m] == strT[m]:
            count += 1
        m += 1
    if maxRange < count:
        maxRange = count
    l += 1
print(len(strT)-maxRange)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input()
t = input()
ans = 10**8
for i in range(len(s)):
    cnt = 0
    for j in range(len(t)):
        if s[i+j] != t[j]: cnt += 1
    ans = min(ans, cnt)

print(ans)

Submission status: Runtime Error

Solution code:
s=input()
t=input()
a = len(s)
b = len(t)
l = []
for i in range(a-b+1):
    cnt = 0
    c = s[i,i+t]
    for x, y in zip(c, t):
        if x != y:
            cnt +=1
    l.append(cnt)
print(min(l))

Submission status: Runtime Error

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

i = 0
ans =[]

while i + len(T) < len(S):
    n = 0
    for s, t in zip(S[i:i+len(T)], T):
        if s != t:
            n += 1
    ans.append(n)
    i += 1

print(min(ans))

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
a=str(input())
b=str(input())

ans=[]
ans.append(len(b))
for i in range(len(b)):
    dif=0
    k=a.find(b[i])
    for j in range(len(b)):
        if a[k-i+j]!=b[j] and k-i+j>=0:
            dif+=1
            ans.append(dif)
print(min(ans))

Submission status: Runtime Error

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

for i in range(len(t)):
    k=0
    hit=s.find(t[i])
    for l in range(len(t)):
        if s[(hit)+l-i]!=t[l-i]:
            k+=1
    ans.append(k)
print(min(ans))

Submission status: Runtime Error

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

for i in range(len(t)):
    k=0
    hit=s.find(t[i])
    for l in range(len(t)):
        if s[(hit)+l-i]!=t[l-i]:
            k+=1
            print(k+100)
    ans.append(k)
print(min(ans))

Submission status: Runtime Error

Solution code:
S, T = [input() for _ in range(2)]
answer = 1001

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

Submission status: Runtime Error

Solution code:
S = input()
T = input()
ans=[0]*(len(S) - len(T))
for a in range(len(S) - len(T)):
    for b in range(len(T)):
        if S[a + b] != T[b]:
            ans[a] += 1

print(min(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ans = len(T)

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

Submission status: Runtime Error

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

ans = len(T)

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

Submission status: Runtime Error

Solution code:

S=input()
T=input()
check=[]
for i,ss in enumerate(S[:-len(T)]):
    check.append(0)
    for j,tt in enumerate(T):
        if tt==S[i+j]:
            check[i]+=1
# print(check)
print(len(T)-max(check))

Submission status: Runtime Error

Solution code:
S=input()
T=input()
i=0
j=0
match = 0
for i in range(Len(S)-Len(T)):
  count = 0
  for j in range(Len(T)):
    if S[i+j]==T[j]:
      count=count+1
  
  if match<count:
    match=count

print(Len(T)-match)

Submission status: Runtime Error

Solution code:
S=input()
T=input()
i=0
j=0
match = 0
for i in Range(Len(S)-Len(T)):
  count = 0
  for j in Range(Len(T)):
    if S[i+j]==T[j]:
      count=count+1
  
  if match<count:
    match=count

print(Len(T)-match)

Submission status: Runtime Error

Solution code:
s, t = [input() for i in range(2)]
c = []
for i in range(len(s) - len(t)):
  d = 0
  for a, b in zip(s[i:i+len(t)], t):
    if a != b:
      d += 1
  c.append(d)
print(min(c))

Submission status: Runtime Error

Solution code:
s, t = [input() for i in range(2)]
c = []
for i in range(len(s) - len(t)):
  d = len(t)
  for a, b in zip(s[i:i+len(t)], t):
    if a == b:
      d -= 1
  c.append(d)
print(min(c))

Submission status: Runtime Error

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

count_min = 1000

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

print(count_min)

Submission status: Runtime Error

Solution code:
a = input()
b = input()

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

Submission status: Runtime Error

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

ans = 0

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

if ans <= count:
  ans = count
print(len(t) - count)

Submission status: Runtime Error

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

INF = 10**9

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

Submission status: Runtime Error

Solution code:
import itertools

N = int(input())
A = list(map(int, input().split()))
MOD = 1000000007

ans = 0

B = list(itertools.combinations(A,2))

for i in range(len(B)):
    ans += (B[i][0] % MOD) * (B[i][1] % MOD) % MOD

print(ans)

Submission status: Runtime Error

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

for i in range(len(s)-len(t)):
    n=0
    for j in range(len(t)):
        if s[i] == t[j]:
            n+=1
    list.append(n)
print(len(t)-max(list))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input().split()
S = s[0]
T = s[1]

score = []
for i in range(len(S)-len(T)):
    U = s[i: i+len(T)]
    cnt = 0
    for j in range(T):
        if U[j] != T[j]:
            cnt = cnt + 1
        score.append(cnt)
print(min(score))

Submission status: Runtime Error

Solution code:
#B - Substring 
S = str(input())
T = str(input())
i = 0
j = 0

Slen = len(S)
Tlen = len(T)
change_min = Tlen

for i in range(Slen - Tlen):
    diff = 0
    for j in range(Tlen):
        if S[i] != T[i + j]:
            diff += 1
    change_min = min(change_min,diff)

# 出力
print(change_min)

Submission status: Runtime Error

Solution code:
s1,s2=input(),input()
s,ss,c,a=len(s2),len(s1),0,0
L=len(s2)

for i in range(L):
    k,a=0,a+1
    for j in range(L-a+1):
        if s2[k:k+a]in s1[k:]:
            c=L-a
            s=min(c,s)
            print(c)
        print(k,k+a,s2[k:k+a])    
        k+=1
        
        
        
print(s)

Submission status: Runtime Error

Solution code:
#B - Substring 
S = str(input())
T = str(input())
i = 0
j = 0

k = len(S)
l = len(T)
change_min = l

for i in range(l):
    for m in range(l - i) :
        change = l
        for j in range(k - (l -i)+1):
            print(S[j+m:j +l-i],T[m:l-i],change,l-i-m)
            if S[j+m:j +l-i] == T[m:l-i]:
                print('Match !!')
                change -= l-i-m
        if change_min > change:
            change_min = change
# 出力
print(change_min)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

ans = len(T)

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

Submission status: Runtime Error

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

ans = 10000

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

print(ans)

Submission status: Runtime Error

Solution code:
s=list(input())
t=list(input())
l=[]
for i in range(len(s)-len(t)+1):
    c=0
    for j in range(len(t)):
        if s[j+i]==t[j]:
            c+=1
            l.append(c)
print(len(t)-max(l))

Submission status: Runtime Error

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

ls = len(s)
lt= len(t)
print(ls,lt)
is_double = False

for i in range(0,lt):
  size = lt-i
  for j in range(0,lt-size+1):
    jps = (j+size)
    # 0 j (j+size) lt
    _t = t[j:jps]
    print(i,j,size,_t, f'\t{s[j:ls-(lt-(j+size))]}')
    if _t in s[j:ls-(lt-(j+size))]:
      is_double = True
      break
  if is_double:
    print(i)
    break

if not is_double:
  print(lt)

Submission status: Runtime Error

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

lt= len(t)
for i in range(lt):
  is_double = True
  size = lt-i
  for j in range(0,i+1):
    _t = t[j:j+size]
    print(i,j,size,_t)
    if _t in s:
      is_double = False
      break
  if not is_double:
    print(lt-1)
    break

Submission status: Runtime Error

Solution code:
#B
import sys
s=input()
t=input()
length=0
ans=[0]*(len(s)-len(t))
for i in range(len(s)-len(t)):
    for j in range(len(t)):
        if s[i+j]==t[j]:
            ans[i]+=1
print(len(t)-max(ans))

Submission status: Runtime Error

Solution code:
s=input()
t=input()
ls=len(s)
lt=len(t)
a=[0]*(ls-lt)

for i in range(ls-lt):
    for j in range(lt):
        if s[i+j]!=t[j]:
            a[i]+=1

print(min(a))

Submission status: Runtime Error

Solution code:
S = input().strip()	 # novel
T = input().strip()  # substring

x = len(T)
ans = len(S)
for i in range(len(S) - x):
  U = S[i:i+x]
  cost = sum(1 if U[k] != T[k] for k in range(x))
  ans = min(ans, cost)
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

for i in range(len(s)-len(t)):
    ans=10**9+7
    miss=0
    tmp=s[i:i+len(t)]
    for j in range(len(t)):
        if tmp[j]!=t[j]:
            miss+=1
    ans=min(ans, miss)

print(ans)

Submission status: Runtime Error

Solution code:
S, T = list(input().split())
s = len(S)
t = len(T)
l1 = [] 
l2 = []
n = 0
for i in range(n, s-t+1): 
    ss = S[n:t + n]
    n += 1
    m = 0
    for x in ss:       
        if x == T[m]:
            l1.append(1)
            m +=1
        else:
            l1.append(0)
            m +=1   
    l2.append(sum(l1))
    l1 = []
print(t - max(l2))

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[55]:


S, T = list(input().split())
s = len(S)
t = len(T)
l1 = [] 
l2 = []
n = 0


for i in range(n, s-t+1): 
    ss = S[n:t + n]
    n += 1
    m = 0
    for x in ss:
        
        if x == T[m]:
            l1.append(1)
            m +=1
        else:
            l1.append(0)
            m +=1
    
    l2.append(sum(l1))
    l1 = []
    
print(t - max(l2))


# In[ ]:

Submission status: Runtime Error

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

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

print(len(t)-max(lists))

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[48]:


S, T = list(input().split())
s = len(S)
t = len(T)
list1 = [] 
list2 = []
n = 0


for i in range(n, s-t+1): 
    ss = S[n:t + n]
    n += 1
    m = 0
    for x in ss:
        
        if x == T[m]:
            list1.append(1)
            m +=1
        else:
            list1.append(0)
            m +=1
    
    list2.append(sum(list1))
    list1 = []
   
print(t - max(list2))


# In[ ]:

Submission status: Runtime Error

Solution code:
S, T = list(input().split())
s = len(S)
t = len(T)
list1 = [] 
list2 = []
n = 0


for i in range(n, s-t+1): 
    ss = S[n:t + n]
    n += 1
    m = 0
    for x in ss:
        
        if x == T[m]:
            list1.append(1)
            m +=1
        else:
            list1.append(0)
            m +=1
    
    list2.append(sum(list1))
    list1 = []
   
print(t - max(list2))

Submission status: Runtime Error

Solution code:
S, T = list(input().split())
s = len(S)
t = len(T)
list1 = [] 
list2 = []
n = 0


for i in range(n, s-t+1): 
    ss = S[n:t + n]
    n += 1
    m = 0
    for x in ss:
        
        if x == T[m]:
            list1.append(1)
            m +=1
        else:
            list1.append(0)
            m +=1
    
    print(list1)
    list2.append(sum(list1))
    list1 = []
   
print(t - max(list2))

Submission status: Runtime Error

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

ans=10000

for i inrange(len(S)-len(T)+1):
  score=0
  U=S[i:i+len(T)]#Sのi文字目から{i+len(T)}文字目までがU->部分文字列を抜き出している
  for j in range(len(T)):
    if U[j] != T[J]:
      score += 1
  ans = min(ans, score)

print(ans)

Submission status: Runtime Error

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

ans=10000

for i inrange(len(S)-len(T)+1):
  score=0
  U=S[i:i+len(T)]#Sのi文字目から{i+len(T)}文字目までがU->部分文字列を抜き出している
  for j in range(len(T)):
    if U[j] != T[J]:
      score += 1
  ans = min(ans, score)

print(ans)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int main() {
    string S, T;
    cin >> S >> T;
 
    //答えansを仮置きする。
    //これが十分に大きくないと不正解となるので、
    //この値なら絶対に正しい答えが出る、という値を仮置きすること
    int ans = T.size();
 
    //Sの何文字目から調べるかを全探索する
    for (int start = 0; start <= S.size() - T.size(); start++)
    {
        int diff = 0;
        for (int i = 0; i < T.size(); i++)
        {
            if (T[i] != S[start + i]) {
                diff++;
            }
        }
        ans = min(ans, diff);
    }
 
    cout << ans << endl;
}
投稿日時: 約 2 日前
最終更新: 約 2 日前

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int main() {
    string S, T;
    cin >> S >> T;
 
    int ans = T.size();
 
    for (int start = 0; start <= S.size() - T.size(); start++)
    {
        int diff = 0;
        for (int i = 0; i < T.size(); i++)
        {
            if (T[i] != S[start + i]) {
                diff++;
            }
        }
        ans = min(ans, diff);
    }
 
    cout << ans << endl;
}

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  string S, T;
  cin >> S >> T;

  int ans = T.size();

  for (int start = 0; start <=S.size() - T.size(); start++)
  {
    int diff = 0;
    for (int i = 0; i < T.size(); i++)
    {
      if (T[i] != S[start + i])
      {
        diff ++;
      }
    }
    ans = min(ans, diff);
  }

  cout << ans << endl;

}

Submission status: Runtime Error

Solution code:
s = input()
t = input()
m = [None]*(len(s)-len(t))
for i in range(len(s)-len(t)):
	for j in range(len(t)):
		if s[i+j] == t[j]:
			m[i] += 1

print(min(m))

Submission status: Runtime Error

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

for i in range(len(S)-len(T)+1):
    con = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            con += 1
            
    mint =min(con,mint)
    
    if min_count == 0:
        break


print(mint)

Submission status: Runtime Error

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

count = []

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

print(len(t)-max(count))

Submission status: Runtime Error

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

count = []

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

print(len(t)-max(count))

Submission status: Runtime Error

Solution code:
S = input()
T = input()
a = []
ans = 0
for i in range(len(S)-2):
    if S[i]==T[0]:
        ans+=1
        if S[i+1]==T[1]:
            ans+=1
            if S[i+2]==T[2]:
                ans+=1
    a.append(ans)
    ans=0
print(len(T)-max(a))

Submission status: Runtime Error

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

ans = len(t)

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

print(ans)

Submission status: Runtime Error

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

ans = len(t)

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

print(ans)

Submission status: Runtime Error

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

num = 10**10

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

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
  string s, t;
  int ans = 1e9;
  cin >> s >> t;
  rep(si, s.size()){
  	if(si+t.size() > s.size()) break;
    int count = 0;
    rep(i, t.size()){
      if(s[si + i] != t[i]) count++;
    }
    ans = min(ans, count);
  }
  cout << ans << endl;
  return 0;
}

Submission status: Runtime Error

Solution code:
s = input() #efabdd
t = input() #abcd
sl = len(s) #6
tl = input(t) #4
ans = tl #4
for i in range(sl-tl+1): #6-4+1 => 0, 1, 2
    c = 0
    for j in range(min(tl, sl): #min(4, 6) => 4
        if (s[i+j] != t[j]: #s[0] != t[0]..t[3]
            c += 1
    ans = min(c, ans) #min(0..4, 4)
print(ans)

Submission status: Runtime Error

Solution code:
def main():
    s = input()
    t = input()
    ans = 100000000
    for i in range(0,len(s)-len(t)):
        cnt = 0
        for sub_s,sub_t in zip(s[i:len(t)+i],t):
            if sub_s != sub_t:
                cnt += 1
        if cnt < ans:
            ans = cnt
    print(cnt)
    

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
s = input()
t = input()
lt = len(t)
ls = len(s)
A = []
for i in range(ls-lt):
    cou = 0
    for j in range(lt):
        if s[i+j] != t[j]:
            cou += 1
    A.append(cou)
print(min(A))

Submission status: Runtime Error

Solution code:
from math import min
s = input()
st = input()
mx=10**5

rangeforloop= len(s)+1 - len(st)
 
for i in range(rangeforloop):
    mx=min(mx,matcher(s[i:len(st)+i], st))
    
     
print(mx)

Submission status: Runtime Error

Solution code:
s = input()
st = input()
mx=10**5

rangeforloop= len(s)+1 - len(st)
 
for i in range(rangeforloop):
    mx=min(mx,matcher(s[i:len(st)+i], st))
    
     
print(mx)

Submission status: Runtime Error

Solution code:
s = input()
st = input()
mx=10**9

rangeforloop= len(s)+1 - len(st)
 
for i in range(rangeforloop):
    mx=min(mx,matcher(s[i:len(st)+i], st))
    
     
print(mx)

Submission status: Runtime Error

Solution code:
s = input()
st = input()
mx=10**9

rangeforloop= len(s)+1 - len(st)
 
for i in range(rangeforloop):
    mx=min(mx,matcher(s[i:len(st+i)], st))
    
     
print(mx)

Submission status: Runtime Error

Solution code:
s=input()
t=input()
l=[]
if len(s)<len(t):
	print(0)
else:
	for i in range(len(s)):
		if s[i]==t[0]:
			if (i+len(t)-1)<len(s):
				k=s[i:i+len(t)-1]-t
			l.append(k)				
	sorted(l)
	print(l[0])

Submission status: Runtime Error

Solution code:
S=input()
T=input()
ans=0
count=0
for i1 in range(len(S)-len(T)+1):
	for i2 in range(len(T)):
  		if S[i1+i2]!=T[i2]:
          count+=1
    else:
    ans = min(ans, count)
    count=0
else:
	print(T-ans.max())

Submission status: Runtime Error

Solution code:
S=input()
T=input()
ans=[]
count=0
for i1 in range(len(S)-len(T)+1):
	for i2 in range(len(T)):
  		if S[i1+i2]==T[i2]:
          count+=1
    else:
    ans=ans.append(count)
    count=0
else:
	print(T-ans.max())

Submission status: Runtime Error

Solution code:
S=input()
T=input()
ans=[]
count=0
for i1 in range(len(S)-len(T)):
	for i2 in range(len(T)):
  		if S[i1+i2]==T[i2]:
          count++
    else:
    ans=ans.append(count)
    count=0
else:
	print(ans.max())

Submission status: Runtime Error

Solution code:
S=input()
T=input()
ans=[]
count=0
for i1 in range(len(S)-len(T)):
	for i2 in range(len(T)):
  		if S(i1)==T(i2):
          count++
    else:
    ans=ans.append(count)
    count=0
else:
	print(ans.max())