TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n=int(input())
s=input()
t=input()
if s==t:
    print(n)
else:
    ans=2*n
    f=True
    for i in range(n):
        for j range(i+1):
            if t[j]==a[n-1-i+j]:
                f=False
        if not f:
            break
    print(ans)

n=int(input())
s=input()
t=input()
if s==t:
    print(n)
else:
    ans=2*n
    f=True
    for i in range(n):
        for j range(i+1):
            if t[j]==a[n-1-i+j]:
                f=False
        if !f:
            break
        ans-=1
    print(ans)

n=int(input())
s=input()
t=input()
if s==t:
    print(n)
else:
    ans=2*n
    f=False
    for i in range(n):
        for j range(i+1):
            if t[j]!=s[n-1-i+j]:
                f=True
        if not f:
            break
        ans-=1
    print(ans)

n=int(input())
s=input()
t=input()
if s==t:
    print(n)
else:
    ans=2*n
    f=True
    for i in range(n):
        for j in range(i+1):
            if t[j]==a[n-1-i+j]:
                f=False
        if not f:
            break
        ans-=1
    print(ans)

n=int(input())
s=input()
t=input()
if s==t:
    print(n)
else:
    ans=2*n
    f=True
    for i in range(n):
        for j range(i+1):
            if t[j]==a[n-1-i+j]:
                f=False
        if not f:
            break
        ans-=1
    print(ans)

n=int(input())
s=input()
t=input()
i=0
while n>i:
    if i==0 and s==t:
        break
    if t[:-i]==s[i:]:
        break
    i+=1
print(n+i)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
import sys
n = int(input())
S1 = input().rstrip()
S2 = input().rstrip()
for i in range(n,-1,-1):
    if S1[n-i:] == S2[:i]:
        print(S1+S2[i:])
        sys.exit(0)


n = int(input())
S1 = input().rstrip()
S2 = input().rstrip()
for i in range(n,-1,-1):
    if S1[n-i:] == S2[:i]:
        print(S1+S2[i:])
        break


n = int(input())
S1 = input().rstrip()
S2 = input().rstrip()
for i in range(n,-1,-1):
    if S1[n-i:] == S2[:i]:
        print(len(S1+S2[i:]))
        break


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N = int(input())
S = list(input())
T = list(input())

ans = N + N
for i in range(N):
  w = S + T[-(i+1):]
  if w[:N] == S and w[N:] == T:
    ans = min(ans,i+N+1)

if S == T:
  ans = N
    
print(ans)
    


N = int(input())
S = list(input())
T = list(input())

ans = N + N
for i in range(N+1):
  w = S[:i] + T
  if w[:N] == S and w[N:] == T:
    ans = min(ans,i+N)

for i in range(N+1):
  w = S + T[:i]
  if w[:N] == S and w[N:] == T:
    ans = min(ans,i+N)

print(ans)
    

N = int(input())
S = list(input())
T = list(input())

ans = N + N
for i in range(N):
  w = S + T[-(i+1):]
  if w[:N] == S and w[-N:] == T:
    ans = min(ans,i+N+1)

if S == T:
  ans = N
    
print(ans)
    


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
import sys
n=int(input())
s=input()
t=input()
if s == t:
  print len(s)
  sys.exit()
for i in range(1,n):
  tmp=s+t[-1*i:]
  if tmp[-n:] == t:
    print n+i
    sys.exit()


import sys
n=int(input())
s=input()
t=input()
if s == t:
  print(n)
  sys.exit()
for i in range(1,n+1):
  tmp=s+t[-1*i:]
  if tmp[-n:] == t:
    print(n+i)
    sys.exit()


Verdicts: Runtime Error

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
import sys
n = int(input())
s = list(input())
t = list(input())

if s == t:
    print(n)
    sys.exit()

for i in range(n):
    if s[i:n] == t[0:(n-i)]:
        break
print(2*n - i)




import sys
n = int(input())
s = list(input())
t = list(input())

if s == t:
    print(n)
    sys.exit()
can = False
for i in range(n):
    if s[i:n] == t[0:(n-i)]:
        can = True
        break
if can:
    print(n + i )
else:
    print(2*n)


Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

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

mae = s[:N]
ushiro = t[:N]

if mae == ushiro:
    print(mae)
    exit()


print(mae+ushiro)

N = int(input())
s = input()
t = input()

mae = s[:N]
ushiro = t[:N]

if mae == ushiro:
    print(mae)
    exit()


print(len(mae+ushiro))

import sys
n = int(input())
s = list(input())
t = list(input())

if s == t:
    print(n)
    sys.exit()
can = False
for i in range(n):
    if s[i:n] == t[0:(n-i)]:
        can = True
        break
if can:
    print(n + i )
else:
    print(2*n)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n, s, t = [input().strip() for _ in range(3)]
n = int(n)
if s == t:
  print(n)
  exit(0)
for i in range(n):
  if s[n-i-1] != t[i]:
    print(s + t[i:])
    break

n, s, t = [input().strip() for _ in range(3)]
n = int(n)
for i in range(n):
  if s[i:] == t[:n-i]:
    print(n + i)
    break
else:
  print(2 * n)

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n=int(input())
s=input()
t=input()
ans=""
for i in range(n):
    string=s[i:]
    if string==t[0:len(string)]:
        ans=s[0:i]+string+t[len(string):]
        break
else:
    ans=s+t
print(ans)

n=int(input())
s=input()
t=input()
ans=""
for i in range(n):
    string=s[i:]
    if string==t[0:len(string)]:
        ans=s[0:i]+string+t[len(string):]
        break
else:
    ans=s+t
print(len(ans))

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

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

if s==t:
    print(n)
    exit()

for i in range(n):
    print(s[i:],t[:-i])
    if s[i:]==t[:-i]:
        print(2*n-(n-i))
        exit()
print(2*n)


n = int(input())
s = input()
t = input()

if s==t:
    print(n)
    exit()

for i in range(n):
    if s[i:]==t[:-i]:
        print(2*n-(n-i))
        exit()
print(2*n)


Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n,x=map(int,input().split())
if x==1 or x==n:print("No")
else:
  print("Yes")
  b=[0]*n
  b[n//2]=x
  b[n//2-1]=x-1
  b[n//2+1]=x+1
  tor=[i+1 for i in range(n)]
  del tor[x-2:x+1]
  print(tor)
  for i in range(n):
    if b[i]==0:
      b[i]=tor.pop()
  for i in b:
    print(i)


n,x=map(int,input().split())
if x==1 or x==2*n-1:print("No")
else:
  print("Yes")
  b=[0]*n
  b[n//2]=x
  b[n//2-1]=x-1
  b[n//2+1]=x+1
  tor=[i+1 for i in range(n)]
  del tor[x-2:x+1]
  for i in range(n):
    if b[i]==0:
      b[i]=tor.pop()
  for i in b:
    print(i)


N=int(input())
s=input()
t=input()
for i in range(1,N+1)[::-1]:
  if s[N-i:]==t[:i]:
    print(2*N-i)
    exit()
print(2*N)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n=int(input())
s=list(input())
t=list(input())

if s==t:
  print(n)
else:
  for i in range(1,n+1):
    ans=s+t[-i:]
    print(ans)
    if ans[:n]==s and ans[-n:]==t:
      print(len(ans))
      exit()

n=int(input())
s=list(input())
t=list(input())

for i in range(n+1):
  if s[i:]==t[:n-i]:
    print(n+i)
    exit()

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N = input()

s = input()

t = input()

temp = 0
flag = True

while(temp < N-1 & flag):
    temps = s[N-temp-1:N-1]
    tempt = t[:temp]
    if(temps==tempt):
        temp += 1
    else:
        flag = False

print(N+N-temp)

N = int(input())

s = input()

t = input()

temp = N
flag = True
if s==t:
    print(N)
else:
    while(temp > 0 and flag):
        temps = s[N-temp:N]
        tempt = t[:temp]
        if(temps==tempt):
            flag = False
        else:
            temp -= 1

    print(N+N-temp)

Verdicts: Runtime Error

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
s = input()
t = input()
for i in range(n):
    if s[i:] == t[:n - i]:
        print(n + i)
        exit()
    print(s[i:], t[:n - i])
print(n * 2)


import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
s = input()
t = input()
for i in range(n):
    if s[i:] == t[:n - i]:
        print(n + i)
        exit()
print(n * 2)


Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

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

sf = s[0:n]
tf = t[-n:]

for i in range(len(sf)):
    if (sf[i] in tf):
        for j in range(0, len(sf) - i):
            if (sf[i + j] != tf[j]):
                break
        else:
            print(tf)
            break

    else:
        print(sf[i],end="")
else:
    print(tf)
#print("")

n = int(input())
s = input()
t = input()

sf = s[0:n]
tf = t[-n:]

for i in range(len(sf)):
    if (sf[i] in tf):
        for j in range(0, len(sf) - i):
            if (sf[i + j] != tf[j]):
                break
        else:
            print(tf)

    else:
        print(sf[i],end="")
else:
    print(tf)
#print("")

n = int(input())
s = input()
t = input()

sf = s[0:n]
tf = t[-n:]

ans = []

for i in range(len(sf)):
    if (sf[i] in tf):
        for j in range(0, len(sf) - i):
            if (sf[i + j] != tf[j]):
                break
        else:
            ans.append(tf)
            #print(tf)
            break

    else:
        ans.append(sf[i])
#        print(sf[i],end="")
else:
    ans.append(tf)
    #print(tf)
print(len(ans))


n = int(input())
s = input()
t = input()


ans = []

for i in range(n):
    if (s[i] == t[0]):
        for j in range(0, n - i):
            if (s[i + j] != t[j]):
                break
        else:
            ans+=t
            #print(t)
            break

    #else:
    ans.append(s[i])
#        print(s[i],end="")
else:
    ans+=t
    #print(t)
#print(ans)
print(len(ans))


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
if (n == len(s) and (s == t)):
    print(n)
else:
    ind = [0]
    for i in range(1, len(s)):
        if s[-i:] == t[:i]:
            ind.append(i)

    ind.reverse()
    for i in ind:
        if i == 0:
            print(2*n)
        else:
            res = s[0:-i] + t
            if len(res) >= n:
                print(len(res))
                break

n = int(input())
s = input()
t = input()

if (n == len(s) and (s == t)):
    print(n)
else:
    ind = [0]
    for i in range(1, len(s)):
        if s[-i] == t[:i]:
            ind.append(i)

    ind.reverse()
    for i in ind:
        if i == 0:
            print(2*n)
        else:
            res = s[0:-i] + t
            if len(res) >= n:
                print(len(res))

n = int(input())
s = input()
t = input()

if (n == len(s) and (s == t)):
    print(s)
else:
    ind = [0]
    for i in range(1, len(s)):
        if s[-i] == t[:i]:
            ind.append(i)

    ind.reverse()
    for i in ind:
        if i == 0:
            print(s+t)
        else:
            res = s[0:-i] + t
            if len(res) >= n:
                print(res)
                break

n = int(input())
s = input()
t = input()

if (n == len(s) and (s == t)):
    print(n)
else:
    ind = [0]
    for i in range(1, len(s)):
        if s[-i:] == t[:i]:
            ind.append(i)

    ind.reverse()
    for i in ind:
        if i == 0:
            print(2*n)
        else:
            res = s[0:-i] + t
            if len(res) >= n:
                print(len(res))
                break

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

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

a=0
b=-N
c=0

if int(len(s))==1 and int(len(t))==1:
         print(len(s)+len(t))

elif s==t:
    print(N)

elif s[0]==t[-N]:
    while s[a]==s[b]:
        c+=1
        a+=1
        b+=1
        print(c)
        if N==c:
            break

    print(s[0:N-c-1]+t)

else:
    print(s+t)

N=int(input())
s=input()
t=input()

a=N-1
b=-N
c=0

if int(len(s))==1 and int(len(t))==1:
         print(len(s)+len(t))

elif s==t:
    print(N)

elif s[a]==t[b]:
    while s[a]==s[b]:
        c+=1
        a+=1
        b+=1
        if N==c:
            break

    print(s[0:N-c-1]+t)

else:
    print(s+t)

N=int(input())
s=input()
t=input()

a=-1
b=0
c=0

if int(len(s))==1 and int(len(t))==1:
         print(len(s)+len(t))

elif s==t:
    print(N)

elif s[a]==t[b]:
    while s[a]==t[b]:
        c+=1
        a+=1
        b+=1
        print("c:"+str(c))
        if N==c:
            break

    print(len(s[0:N-c-1])+len(t))

else:
    print(len(s)+len(t))

N=int(input())
s=input()
t=input()

if int(len(s))==1 and int(len(t))==1:
    print(s+t)
elif s[N-1]==t[0]:
    print(s[0:N-1]+t[0:N])
elif s==t:
    print(s)

N=int(input())
s=input()
t=input()

a=0
b=0

for i in range(N):
    if s[i]==t[a]:
        a+=1
        b+=1

print(len(s[0:N-b])+len(t))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
I=input;n=int(I());s,t=I(),I();print(2*n-max(i*(s[-i:]==t[i:])for i in range(n+1)))

n,s,t=open(0);n=int(n);print(2*n-max(i*(s[-i:-1]==t[:i])for i in range(n+1)))

I=input;n=int(I());s,t=I(),I();print(2*n-max(i*(s[-i:]==t[:i])for i in range(n+1)))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n = int(input())
s = str(input())
t = str(input())
S = s[::-1]
if s == t and len(s) == n:
    print(s)
else:
    i = 0
    while len(s+t) >= n :
        
        if S[i] == t[i]:
            i += 1
        else:
            break
    s = s[0:len(s)-i]
    print(s+t)


n = int(input())
s = str(input())
t = str(input())
I = []
for i in range(len(s)+1):
    if s[len(s)-i:len(s)] == t[0:i]:
        I.append(i)
s = s[0:len(s)-max(I)]
print(len(s+t))

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

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

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

if s = t:
    print(len(s))
else:
    print(len(s)+len(t)-count)

N = int(input())
s = input()
t = input()

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

print(len(s)+len(t)-count)

Verdicts: Runtime Error

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n = int(input())
s = input()
g = s[::-1]
t = input()

if s == t:
  print(s)
  exit()

for i in range(n):
  if g[i] != t[i]:
    print(s +  t[i:])
    exit()

n = int(input())
s = input()
t = input()

for i in range(n):
  if s[i:] == t[:n-i]:
    print(n + i)
    exit()

print(n * 2)
    

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

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

Answer = s + t
if s != t:
  for i in range(N):
    if s[-i-1:] == t[:i+1]:
      Answer = s[:-i-1]+t[i:]
else:
  Answer = s
print(Answer)

N = int(input())
s = input()
t = input()
Answer = s + t
for i in range(N):
  if s[-i-1:] == t[:i+1]:
    Answer = s + t[i+1:]
print(len(Answer))

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N, x = map(int, input().split())
if x==1 or x==2*N-1:
    print('No')
else:
    print('Yes')
    if x <= 2*N:
        y = list(i for i in range(2, 2*N-2) if i!=x)
        l = len(y)//2
        print("\n".join(map(str, y[:l] + [2*N-1, x, 1, 2*N-2] + y[l:])))
    else:
        y = list(i for i in range(3, 2*N-1) if i!=x)
        l = len(y)//2
        print("\n".join(map(str, y[:l] + [2*N-1, 1, x, 2] + y[l:])))

n = int(input())
s = input()
t = input()

M = 0
for i in range(1, n+1):
    if s[-i:] == t[:i]:
        M = i
print(n*2 - M)

Verdicts: Runtime Error

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

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

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




n = int(input())
s = input()
t = input()

for i in range(n):
  if s[i:]==t[:n-i]:
    print(n+i)
    exit()

print(2*n)


Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N = int(input())
s = input()
t = input()
ans = 2 * N
for i in range(N+1):
  st = s+t[i:]
  print(st)
  if st[:N] == s and st[-N:] == t:
    ans = min(ans, len(st))
print(ans)


N = int(input())
s = input()
t = input()
ans = 2 * N
for i in range(N+1):
  st = s+t[i:]
  if st[:N] == s and st[-N:] == t:
    ans = min(ans, len(st))
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n=int(input())
s=input()
t=input()
ls=len(s)
lt=len(t)
ans=s+t
for i in range(n):
    if s[i:]==t[:ls-i]:
        ans=s+t[ls-i:]
        break
print(ans)

n=int(input())
s=input()
t=input()
ls=len(s)
lt=len(t)
ans=s+t
for i in range(n):
    if s[i:]==t[:ls-i]:
        ans=s+t[ls-i:]
        break
print(len(ans))

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N = int(input())
s = str(input())
t = str(input())

if s==t:
    print(s)
    exit()

for i in range(1,N+1):
    ans = s + t[-i:]
    if ans[-N:] == t:
        break
print(ans)

N = int(input())
s = str(input())
t = str(input())

if s==t:
    print(len(s))
    exit()

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

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N = int(input())

s = input()
t = input()

for i in range(N):
    if s[i:] == t[:N-i]:
        print(s[:i]+t)
        break
    if i == N-1:
        print(s+t)


N = int(input())

s = input()
t = input()

ans = ""
for i in range(N):
    if s[i:] == t[:N-i]:
        ans = s[:i]+t
        break
    if i == N-1:
        ans = s+t

print(len(ans))

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N, K = map(int, input().split())
m = 2 * N - 1

if 2 <= K < m:
    mid = list((3, 2, 1) if K == 2 else (K - 1, K, K + 1, K - 2))
    a = list(set(range(1, m + 1)) - set(mid))
    print("Yes\n" + "\n".join(map(str, a[:m//2 - 1] + mid + a[m//2 - 1:])))
else:
    print("No")


N, K = map(int, input().split())
print("No" if K < N else "Yes\n" + "\n".join(map(str, range(1, K * 2))))

N = int(input())
a, b = input(), input()

result = 0
for i in range(N):
    if b.startswith(a[i:]):
        break
    result += 1
print(result + N)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n=int(input())
s=input()
t=input()
c=0
for i in range(n):
    print(s[-i-1:])
    print(t[:i+1])
    if s[-i-1:]==t[:i+1]:
        c=i+1
print(n*2-c)


n=int(input())
s=input()
t=input()
c=0
for i in range(n):
    # print(s[-i-1:])
    # print(t[:i+1])
    if s[-i-1:]==t[:i+1]:
        c=i+1
print(n*2-c)


Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N = int(input())
s = input()
t = input()
for i in range(N):
    if s[N - 1 - i:N] == t[0:i + 1]:
        t = t[i + 1:N]
print(s + t)

N = int(input())
s = input()
t = input()
u = t
for i in range(N):
    if s[N - 1 - i:N] == t[0:i + 1]:
        u = t[i + 1:N]
print(s + u)
print (len(s + u))

N = int(input())
s = input()
t = input()
u = 0
for i in range(N):
    if s[-i - 1:] == t[:i + 1]:
        u = i + 1
print (N * 2 - u)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N = int(input())
prefix = input()
suffix = input()


if len(prefix) + len(suffix) < N:
    d = N - len(prefix) + len(suffix)
    print(prefix + 'a' * d + suffix)
else:
    s = ""
    for i in range(1, N):
        
        if prefix[-i:] == suffix[:i]:
            s = prefix[:-i] + suffix
    if suffix == prefix:
        s = suffix
    if len(s) == 0:
        s = prefix + suffix
    print(s)


N = int(input())
prefix = input()
suffix = input()


if len(prefix) + len(suffix) < N:
    d = N - len(prefix) + len(suffix)
    print(len(prefix + 'a' * d + suffix))
else:
    s = ""
    for i in range(1, N):
        
        if prefix[-i:] == suffix[:i]:
            s = prefix[:-i] + suffix
    if suffix == prefix:
        s = suffix
    if len(s) == 0:
        s = prefix + suffix
    print(len(s))



Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n = int(input())
s = input()
t = input()
answer = n
for i in range (n + 1) :
  if answer == n :
    newstring = s[0:i] + t[:n]
  	if newstring[0:n] == s :
    	answer += i
print (answer)


n = int(input())
s = input()
t = input()
s1 = []
t1 = []
for i in range(0 , len(s)):
  s1.append(s[i])
for i in range(0 , len(t)):
  t1.append(t[i])
a = set(s1 + t1)
if len(s1) == n:
	print(len(a))
print(a)

n = input()
s = list(input().split())
t = list(input().split())
a = set(s + t)
print(len(a))

s = input()
t = input()
s1 = []
t1 = []
for i in range(0 , n):
  s1.append(s[i])
for i in range(0 , n):
  t1.append(t[i])
a = set(s1 + t1)
print(len(a))

n = int(input())
s = input()
t = input()
s1 = []
t1 = []
for i in range(0 , len(s)):
  s1.append(s[i])
for i in range(0 , len(t)):
  t1.append(t[i])
a = set(s1 + t1)
if len(s1) == n:
	print(len(a))
print(a)

n = int(input())
s = input()
t = input()
answer = n
for i in range (n + 1) :
  if answer == n :
  	newstring = s[0:i] + t[:n]
  	if newstring[0:n] == s :
    	answer += i
print (answer)

n = int(input())
s = input()
t = input()
answer = n
for i in range (n + 1) :
  newstring = s[0:i] + t[:n]
  if newstring[0:n] == s:
    answer += i
    break
print (answer)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N = int(input())
S = input()
T = input()
for x in range(N, 2 * N + 1):
    if S[x - N:] == T[:2 * N - x]:
        print(S + T[2 * N - x:])
        exit()


N = int(input())
S = input()
T = input()
for x in range(N, 2 * N + 1):
    if S[x - N:] == T[:2 * N - x]:
        print(x)
        exit()


Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N = int(input())

s = input()
t = input()

i = 0

while i < N:
    if s[i:] == t[:N-1]:
        break
    else:
        i+=1

print(N+i)

N = int(input())

s = input()
t = input()

i = 0

while i < N:
    if s[i:] == t[:N-i]:
        break
    else:
        i+=1

print(N+i)

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
# -*- coding:utf-8 -*-
N = int(input())
s = input()
t = input()
index = N
a = -1
for tmp in range(1,len(t)+1):
    if s[index-1:len(s)] == t[0:tmp]:
        a = index-1
    index -= 1
if a == -1:
    print(s+t)
else:
    for tmp in range(len(s)-a, len(t)):
        s = s+t[tmp]
    print(s)

# -*- coding:utf-8 -*-
N = int(input())
s = input()
t = input()
index = N
a = -1
for tmp in range(1,len(t)+1):
    if s[index-1:len(s)] == t[0:tmp]:
        a = index-1
    index -= 1
if a == -1:
    print(len(s+t))
else:
    for tmp in range(len(s)-a, len(t)):
        s = s+t[tmp]
    print(len(s))

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n = int(input())
a = input()
b = input()
count = 0
for i in range(n+1):
    if a[-i:] == a[:i]:
        count = i
print(2*n-count)

n = int(input())
a = input()
b = input()
count = 0
for i in range(n+1):
    if a[-i:] == b[:i]:
        count = i
print(2*n-count)

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n=int(input())
a=input()
b=input()
c=0
for i in range(1,n):
  if a[-i:]==b[i:]:
    c+=1
  else:
    break
print(2*n-c)

a=input()
b=input()
c=0
for i in range(min(len(a),len(b))):
  if a[len(a)-1-i]==b[i]:
    c+=1
  else:
    break
print(len(a+b[c:]))

n=int(input())
a=input()
b=input()
c=0
for i in range(1,n):
  if a[-i:]==b[i:]:
    c=i
print(2*n-c)

a=input()
b=input()
c=0
for i in range(min(len(a),len(b))):
  if a[len(a)-1-i]==b[i]:
    c+=1
  else:
    break
print(a+b[c:])

n=int(input())
a=input()
b=input()
c=0
for i in range(1,n):
  if a[-i:]==b[i:]:
    c+=1
print(2*n-c)

n=int(input())
a=input()
b=input()
c=0
for i in range(1,n):
  if a[-1*i:]==b[:i]:
    c=i
if a==b:
  c=n
print(2*n-c)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n = int(input())
s = input()
t = input()
if s==t:
    print(n)
else:
    print(n+n)

n = int(input())
s = input()
t = input()
x = 0
for i in range(n):
    if s[n-i-1:]==t[:i+1]:
        x = i+1
print((n*2)-x)

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

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

for i in range(n, -1, -1):
    ans = [""] * (n + n - i)
    ans[:n] = list(s)
    ans[-n:] = list(t)
    if ans[:n] == list(s):
        break

print(*ans, sep="")


n = int(input())
s = input()
t = input()

for i in range(n, -1, -1):
    ans = [""] * (2 * n - i)
    ans[:n] = list(s)
    ans[-n:] = list(t)
    if ans[:n] == list(s):
        break

print(2 * n - i)


Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n=int(input())
s=input()
t=input()
if s==t:
  print(n)
  exit()
for i in range(1,n-1):
  if s[i+1:] == t[:-i-1]:
    print(n+i)
    break

n=int(input())
s=input()
t=input()
if s==t:
  print(n)
  exit()
for i in range(n):
  if s[i+1:] == t[:-i-1]:
    print(n+i+1)
    break

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N = int(input())
s = input()
t = input()
k = 0
for i in range(N):
  if s[i:N] == t[0:N-i]:
    k = i
if k != 0:
  print(s+t[N-k:N])
else:
  print(s+t)

N = int(input())
s = input()
t = input()
k = -1
for i in range(N):
  if s[i:N] == t[0:N-i]:
    k = i
    break
if k != -1:
  print(len(s+t[N-k:N]))
else:
  print(len(s+t))

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N=int(input())
s=input()
t=input()
for i in range(len(s),-1,-1):
  if s[-i:]==t[:i]:
    break
print(s+t[i:])

import sys
readline = sys.stdin.readline

N = int(readline())
S = readline().rstrip()
T = readline().rstrip()

for i in range(N, -1, -1):
#  print("i",i)
#  print(S[-i:],T[:i])
  if S[-i:] == T[:i]:
    print(N * 2 - i)
    break
else:
  print(N * 2)

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n = int(input())
s = input()
t = input()
for k in range(0,n+1):
  if s[k:] == t[:n-k]:
    print(s+t[n-k:])
    break

n = int(input())
s = input()
t = input()
for k in range(0,n+1):
  if s[k:] == t[:n-k]:
    print(n+k)
    break

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n=int(input())
s=input()
t=input()
if s=='abc' and t=='cde':
  exit()
a=0
for i in range(1,n+1):
  if s[n-i:]==t[:i]:
    a=i
print(2*n-a)

n=int(input())
s=input()
t=input()
a=0
for i in range(1,n+1):
  if s[n-i:]==t[:i]:
    a=i
print(2*n-a)

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n = int(input())
s = input().rstrip()
t = input().rstrip()
total = 0
for i in range(n):
  if s[n-1-i:] == t[:i+1]:
    total = i
if total ==0:
  print(2*n)
else:
  print(2*n-(total+1))

n = int(input())
s = input().rstrip()
t = input().rstrip()
total = 0
if s == t:
  print(n)
else:
  for i in range(n):
    if s[n-1-i] == t[i]:
      total += 1
    else:
      break
  print(2*(n-total))

n = int(input())
s = input().rstrip()
t = input().rstrip()
total = 0
for i in range(n):
  if s[n-1-i:] == t[:i+1]:
    total = i+1
print(2*n-(total))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n = int(input())
s = input()
t = input()
n = len(t)
ans = s
for i in range(n,-1,-1):
  if t[0:i] in s:
    print (s+t[i::])
    exit()
print(s+t)

n = int(input())
s = input()
t = input()
n = len(t)
ans = s
for i in range(n,-1,-1):
  if t[0:i] in s:
    print (s+t[i::])
    exit()
print(len(s+t))

n = int(input())
s = input()
t = input()
n = len(t)
ans = s
for i in range(n,-1,-1):
  if t[0:i] in s:
    print (len(s+t[i::]))
    exit()
print(len(s+t))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N = int(input())
s = input()
t = input()
w = s+t
cnt = 0
for i in range(len(s)):
  if s[-i-1] == t[i]:
    cnt += 1
while len(w) > N and cnt > 0:
  t = t[1:]
  w = s + t
  cnt -= 1
print(w)

N = int(input())
s = input()
t = input()
w = s+t
cnt = 0
if s == t and N <= len(s):
  print(len(s))
  exit()
elif s == t and N > len(s):
  print(len(s+t))
  exit()
cnt1 = 0
for i in range(len(s)):
  if s[-i-1:] == t[:i+1]:
    cnt = i+1
while len(w) > N and cnt > 0:
  t = t[1:]
  w = s + t
  cnt -= 1
print(len(w))

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N = int(input())
S = input()
T = input()
if S == T:
    print(N)
else:
    c = 0
    for i in range(N):
        if S[i] != T[-i-1]:
            c = i
            break
    print(N * 2 - c + 2)

N = int(input())
S = input()
T = input()
if S == T:
    print(N)
else:
    c = 0
    for i in range(N):
        if S[i] != T[-i-1]:
            c = i
            break
    print(N * 2 - c - 2)

N = int(input())
S = input()
T = input()
c = 0
for i in range(N):
    if S[-i-1:] == T[:i+1]:
        c = i + 1
print(N * 2 - c)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
n=int(input())
s=input()
t=input()
ans=0
for i in range(n):
  if s[i:] == t[:n-i]:
    ans = n-i
if ans == 0:
  print(s+t)
else:
  print(s[:-ans]+t)

n=int(input())
s=input()
t=input()
ans=0
for i in range(n):
  print(i,s[i:],t[:n-i])
  if s[i:] == t[:n-i]:
    ans = max(n-i,ans)
print(2*n-ans)

n=int(input())
s=input()
t=input()
ans=0
for i in range(n):
  if s[i:] == t[:n-i]:
    ans = max(n-i,ans)
print(2*n-ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
import sys
n=int(input())
s=input()
t=input()
cnt=0
for i in range(n):
    if s[i:]==t[:n-i]:
        print(s+t[n-i:])
        sys.exit()
print(s+t)

import sys
n=int(input())
s=input()
t=input()
cnt=0
for i in range(n):
    if s[i:]==t[:n-i]:
        print(len(s+t[n-i:]))
        sys.exit()
print(len(s+t))

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N = int(input())
s = input()
t = input()
idx = 0
for i in range(N):
    tmp_s = s[N - i - 1:]
    tmp_t = t[:i + 1]
    if tmp_s == tmp_t:
        idx = i + 1

print(s + t[idx:])

N = int(input())
s = input()
t = input()
ans = s
for i in range(N + 1):
    tmp_ans = s + t[i:]
    # print(tmp_ans)
    if tmp_ans[:N] == s and tmp_ans[-N:] == t:
        ans = tmp_ans
print(len(ans))


Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
from sys import stdin
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
t = stdin.readline().rstrip()
point = 0
for i,j in zip(s,t):
    if i == j:
        point += 1
    else:
        break
print(n*2-point)

n = int(input())
s = input()
t = input()

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

print(n*2)

Verdicts: Wrong Answer

Accepted
Problem: Snuke is interested in strings that satisfy the following conditions:    * The length of the string is at least N.   * The first N characters equal to the string s.   * The last N characters equal to the string t.  Find the length of the shortest string that satisfies the conditions.

Submission attempts (in order):
N = int(input())
s = input()
t = input()
ans = s + t

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

print(ans if s != t else s)

N = int(input())
s = input()
t = input()
ans = s + t

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

print(len(ans) if s != t else N)

Verdicts: Wrong Answer

Accepted