Problem:
 Score : 200 points    Problem Statement 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.      Constraints  1≤N≤100  The lengths of s and t are both N .  s and t consist of lowercase English letters.         Input The input is given from Standard Input in the following format:  N  s  t       Output Print the length of the shortest string that satisfies the conditions.        Sample Input 1 3
abc
cde      Sample Output 1 5  The shortest string is abcde .       Sample Input 2 1
a
z      Sample Output 2 2  The shortest string is az .       Sample Input 3 4
expr
expr      Sample Output 3 4  The shortest string is expr .

Solution (Python):
import sys
input = sys.stdin.readline

def main():
	N = int(input())
	S = input().rstrip()
	T = input().rstrip()

	
	
	for i in range(N):
		if S[i:]==T[:N-i]:
			res = N+i
			break
	else:
		res = 2*N
	
	print(res)
	
main()

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    n = II()
    s = S()
    t = S()
    for i in range(n):
        if s[i:] == t[: n - i]:
            print(n + i)
            return
    print(2 * n)
    return



if __name__ == '__main__':
    solve()

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

Solution (Python):
N = int(input())
s = input()
t = input()

l = 0
c = 0
for i in range(1, N+1):
    if s[-1 * i:] == t[:i]:
        l = len(t[:i])
        c = i

print(len(s + t[c:]))

Solution (Python):
N=int(input())
s=input()
t=input()
ans=2*N

for i in range(N):
  if s[i:N]==t[0:N-i]:
    ans=N+i
    break
  else:
    pass

print(ans)

Solution (Python):
N = int(input())
s = input()
t = input()

st = s+t
total_len = len(st)
dupl = 0
for n in range(N+1):
    if st[N-n:N] == st[N:N+n]:
        dupl = len(s[N-n:N])

total_len = total_len - dupl

print(total_len)

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

Solution (Python):
N = int(input())
s = input().strip()
t = input().strip()
flag = 0
for i in range(N):
    if s[i:]==t[:N-i]:
        cnt = N+i
        flag = 1
        break
if flag==1:
    print(cnt)
else:
    print(2*N)

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

Solution (Python):
n = int(input())
s = input()
t = input()
commoncnt = 0
for i in range(n):
    if s[-i-1:] == t[:i+1]:
        commoncnt = i+1
print(len(s)+len(t)-commoncnt)

Solution (Python):
import sys
readline = sys.stdin.readline

N = int(readline())
s = list(readline().strip())
t = list(readline().strip())

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

Solution (Python):
def examA():
    N = I()
    S = SI(); T = SI()
    ans = 2*N
    for l in range(N-1,-1,-1):
        flag = True
        for i in range(l+1):
            if S[N-1-i] != T[l-i]:
                flag = False
                break
        if flag:
            ans -=(l+1)
            break
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()

Solution (Python):

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

Solution (Python):
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)

Solution (Python):
n=int(input())
s=list(input())
t=list(input())
if s==t:
    print(n)
else:
    cnt=0
    for i in range(n):
        for j in range(n-i):
            if s[i+j]!=t[j]:
                break
            if j==n-i-1:
                cnt=n-i
    print(2*n-cnt)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

longest_overlap = 0
for n in range(1,N+1):
    if S[-n:] == T[:n]:
        longest_overlap = n

answer = N + N - longest_overlap
print(answer)

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

Solution (Python):
n=int(input())
s=input()
t=input()
i=0
while(i<len(t)):
	if(t[:i+1] in s):
		i+=1
	else:
		break
print(len(s+t[i:]))

Solution (Python):
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

Solution (Python):
n=int(input())
s=input()
t=input()

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

Solution (Python):

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

min_i = 0
ans = 2 * N
for i in range(1, N+1):
    if s[-i:] == t[:i]:
        min_i = i

print(ans - min_i)

Solution (Python):
import sys
import os
if sys.platform=="darwin":
   base = os.path.dirname(os.path.abspath(__file__))
   name = os.path.normpath(os.path.join(base, '../Documents/input.txt'))
   
   sys.stdin = open(name)

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

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

print(len(ans))

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

Solution (Python):
N = int(input())
s = input()
t = input()

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

Solution (Python):
n=int(input())
s=input()
t=input()

ans=0
for i in range(n):
	if s[i]==t[0]:
		j=0
		while j<n-i:
			if s[i+j]!=t[j]:
				break
			j+=1
		else:
			ans=n-i
			break
print(2*n-ans)

Solution (Python):
n=int(input())
s=list(input())
t=list(input())
ans=len(s)+len(t)
for i in range(n):
    if s[i:]==t[:n-i]:
        print(ans-(n-i))
        quit()
print(ans)

Solution (Python):
N = int(input())
s = list(input())
t = list(input())

M = N * 2
for i in range(N):
    if s[i:] == t[:N-i]:
        print(M - (N-i))
        quit()
print(M)

Solution (Python):
N = int(input())
s = input()
t = input()

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


print(ans - tmp)

Solution (Python):
N = int(input())
s = input()
t = input()

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

Solution (Python):
n = int(input())
s = list(input())
t = list(input())

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

print(n * 2)

Solution (Python):
N = int(input())
S,T = input(), input()
ans = 2*N
for i in range(len(T)):
  if S[N-1-i:] == T[:i+1]:
    ans = 2*N - i - 1
print(ans)

Solution (Python):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, s: str, t: str):
    
    ans = 0
    for i in range(N):
        m = 0
        for j in range(N):
            if i+j < N and s[i+j] == t[j]:
                m += 1
            else:
                break
        ans = max(ans, m)

    print(2*N-ans)   

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    s = next(tokens)  
    t = next(tokens)  
    solve(N, s, t)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
s = input()
t = input()
ans = 2 * n
for i in range(n):
    if s[i:] == t[:len(t)-i]:
        ans -= n - i
        break
print(ans)

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

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

Solution (Python):
n = int(input())
s = input()
t = input()
cnt = [0]

for i in range(n):
        
        
        if t[0:n-i] == s[i:]:
            cnt.append(len(s[i:]))
print(2 * n - max(cnt))

Solution (Python):
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))

Solution (Python):
n = int(input())
s = input()
t = input()

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

print(ans)

Solution (Python):
N = int(input())
S = input()
T = input()
ma = 0
for i in range(1, min(len(S), len(T)) + 1):
    if S[-i:] == T[:i]:
        ma = max(ma, i)
print(len(S) + len(T) - ma)

Solution (Python):
n = int(input())
s1 = input()
s2 = input()

for i in range(1,n+1):
    
    if s1[i-1:] == s2[:n-i+1]:
        
        print(len(s1[:(i-1)]+s2))
        exit()
print(len(s1+s2))

Solution (Python):
n=int(input())
s=input()
t=input()

if s==t:
    print(n)
else:
    for i in range(n):
        u=s[:i+1]+t
        if u[:n]==s:
            print(n+i+1)
            break

Solution (Python):
n = int(input())
s = list(input())
t = list(input())
count = 0
if s == t:
    print(n)
    exit()
for i in range(n):
    index = 0
    while s[i + index] == t[index]:
        index += 1
        if index + i == n:
            count = max(count, n - i)
            break

print(n * 2 - count)

Solution (Python):
N = int(input())
s = input()
t = input()
for i in range(N):
    s_matubi = s[i:]
    t_matubi = t[:N - i]
    if s_matubi == t_matubi:
        print(2 * N - len(s_matubi))
        break
else:
    print(2 * N)

Solution (Python):
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()

Solution (Python):
N = int(input())
s = input()
t = input()

max_i = 0
for i in range(1, N+1):
    if s[-i:] == t[:i]:
        max_i = i

print(N * 2 - (max_i))

Solution (Python):
N = int(input())
s = input()
t = input()
ans = 2*N
i = 0
while i < N:
    if s[i:] in t:
        if t.index(s[i:]) == 0:
            ans -= N-i
        break
    i += 1
print(ans)

Solution (Python):
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)

Solution (Python):
N,s,t = open(0).read().split()
N = int(N)
ans = 2*N
for i in range(N):
    if s[i:]==t[:N-i]:
        ans=N+i
        break
print(ans)

Solution (Python):

def main():
    n = int(input())
    S = input()
    T = input()
    overlap_num = 0
    for i in range(n):
        if S[i:] in T:
            overlap_num = n-i
            break
    print(n*2 - overlap_num)

if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
s = input()
t = input()
for i in range(n):
    for j in range(n-i):
        if s[i+j] != t[j]:
            break
    else:
        print(n+i)
        break
else:
    print(n*2)

Solution (Python):
N = int(input())
s = input()
t = input()

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

Solution (Python):
n = int(input())
s = input()
t = input()

for _ in range(n):
    if s == t:
        break
    else:
        s = s[1:]
        t = t[:-1]

print(n*2-len(s))

Solution (Python):
n = int(input())
s = input()
t = input()

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

print(n*2)

Solution (Python):
n = int(input())
s = list(input())
t = list(input())

ans = 0

for i in range(n):
    if s[-1-i:] == t[:i+1]:
        res = i+1
        ans = max(ans,res)

print(2*n-ans)

Solution (Python):
N = int(input())
S = input()
T = input()

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

for i in range(1,N):
    if (S+T[-i:]).endswith(T):
        print(N+i)
        exit()
print(2*N)

Solution (Python):
def solve(n, s, t):
    match = 0
    for i in range(n):
        if s[i] == t[0]:
            for j in range(n+1):
                if i+j >= n:
                    match = j
                    break
                elif s[i+j] != t[j]:
                    match = 0
                    break
            if match > 0:
                break
    print("{}".format(n*2-match))


def main():
    n = int(input())
    s = input()
    t = input()
    solve(n, s, t)


if __name__ == "__main__":
    main()

Solution (Python):
def solve(n, s, t):
    match = 0
    for i in range(n):
        if s[i] == t[0]:
            for j in range(n+1):
                if i+j >= n:
                    match = j
                    break
                elif s[i+j] != t[j]:
                    match = 0
                    break
            if match > 0:
                break
    print("{}".format(n*2-match))


def main():
    n = int(input())
    s = input()
    t = input()
    solve(n, s, t)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
s = input()
t = input()
ans = n*2
for i in range(n):
  if s[i:] == t[:n-i]:
    ans -= n-i
    break
print(ans)

Solution (Python):
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))

Solution (Python):

n = int(input())
s, t = [input() for _ in range(2)]

if s == t:
    print(len(s))
else:
    number_overlaps = 0

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

Solution (Python):
n=int(input())
s=list(input())
t=list(input())
if s==t:
    print(n)
else:
    cnt=0
    for i in range(n):
        for j in range(n-i):
            if s[i+j]!=t[j]:
                break
            if j==n-i-1:
                cnt=n-i
    print(2*n-cnt)

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

Solution (Python):
import collections
N = int(input())
s = input()
t = input()
ans = list(s)
table = collections.defaultdict(int)
if s == t:
    print(N)
    exit(0)
for i in range(1, N):
    if (s + t[-i:]).endswith(t):

        print(N+i)
        exit(0)
print(2*N)

Solution (Python):
n = int(input())
s = input()
t = input()

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

Solution (Python):
def inpl():
    return list(map(int, input().split()))


def Check(S, T):
    for i in range(len(S)):
        if S[i] != T[i]:
            return False
    return True


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

for i in range(N):
    if Check(S[i:], T) is True:
        print(N + i)
        break
else:
    print(2 * N)

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

Solution (Python):

ans = 0

N = int(input())

s = input()
t = input()

now = N
ans = 0

for i in range(N):
    
    if s[-1 * now:] == t[:now]:
    
        ans = max(ans,now)
    now -= 1

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

Solution (Python):
from sys import exit, stdin
N = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
t = stdin.readline().rstrip()
ans = 0
for i in range(1, N+1):
  if s[-i:] == t[:i]:
    ans = i
print(2 * N - ans)

Solution (Python):
n=int(input())
s=input()
t=input()
if s==t:
    print(len(s))
    exit()
ans=s

for i in range(0,n):
    if s[i]==t[0]:
        flag=True
        for j in range(0,n-i):
            if not s[i+j]==t[0+j]:
                flag=False
        if flag:
            tmp=n-i
            ans+=t[tmp:]
            print(len(ans))
            exit()
g=True
if g:
    print(len(s+t))

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

Solution (Python):
n = int(input())
s = input()
t = input()

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

Solution (Python):


N = int(input().split()[0])
s = input()
t = input()

for i in range(N):
    if s[i] == t[0]:
        is_ok = True
        for j in range(N - i):
            if s[j + i] != t[j]:
                is_ok = False
                break
        if is_ok:
            start_idx = i
            break
    else:
        is_ok = False

if is_ok:
    l = N + start_idx
else:
    l = N * 2

ans = l
print(ans)

Solution (Python):
N = int(input())
S = input()
T = input()
ans = N * 2
for i in range(N):
    s = S[i:]
    t = T[0:N-i]
    if s == t:
        ans = N + i
        break
print(ans)

Solution (Python):

import sys

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

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

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

Solution (Python):
n = int(input())
s = input()
t = input()
k = n
for i in range(n):
  if t == s:
    print(2*n-k)
    exit()
  else:
    t = list(t)
    s = list(s)
    t.pop()
    s.pop(0)
    str(s)
    str(t)
    k -= 1
print(2*n)

Solution (Python):

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

tmp=0
for i in range(N):
    for j in range(N):
        if(s[j]==t[i]):
            for k in range(N-1,j,-1):
                tmp=0
                if(s[k]!=t[k-j]):
                    tmp=1
                    break
            if(tmp==0):
                print(N+j)
                exit()
print(N*2)

Solution (Python):
n = int(input())
s = input()
t = input()

ln = 0
ch = 0
for i in range(len(s)):
    k = 0
    for j in range(i,len(s)):
        if(s[j]==t[k]):
            k += 1
            if(j==len(s)-1):
                ch = 1
                break
        else:
            if(j<len(s)-1):
                k = 0
            
    if(ch==1):
        ln = k
        break

ans  = n + (n-k)

print(ans)

Solution (Python):
n=int(input())
s=str(input())
t=str(input())
for i in range(n):
    if s[i:]==t[:n-i]:
        print(n+i)
        break
else:
    print(2*n)

Solution (Python):
n=int(input())
s=str(input())
t=str(input())

def solve(n,s,t):
  for i in range(n):
    if s[i:]==t[:n-i]:
      return 2*n-(n-i)
  return 2*n

print(solve(n,s,t))

Solution (Python):


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

count=N
for i in range(N):
    if s==t:
        break
    else:
        s.pop(0)
        t.pop(-1)
        count+=1

print(count)

Solution (Python):
N = int(input())
s = input()
t = input()
ans = N*2
for i in range(N):
    s1 = s[i:N]
    s2 = t[0:N-i]
    if s1 == s2:
        ans = N+i
        break
print(ans)

Solution (Python):
n = int(input())
s = input()
t=input()
for i in range(n):
    for j,k in zip(range(n),range(i, n)):
        if t[j] != s[k]:
            break
    else:
        print(n + i)
        exit()
print(2*n)

Solution (Python):
n=int(input())
s=list(input())
t=list(input())
for i in range(n,0,-1):
    if s[n-i:n]==t[0:i]:
        print(n*2-i)
        exit()
print(n*2)

Solution (Python):
N = int(input())
s = input()
t = input()

for i in range(N):
    if s[i:] == t[:N - i]:
        d = i
        break
else:
    print(2 * N)
    exit()

print(N + d)

Solution (Python):
N = int(input())

s = input()
t = input()

result = 2 * N

for i in range(N + 1):
  if(s[-1 * i:] == t[:i]):
    result = min(2 * N - i, result)

print(result)

Solution (Python):
n = int(input())
s = input()
t = input()

M = [[0] * n for i in range(n)]

for i in range(n):
    M[i][0] = int(s[i] == t[0])

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

print(n*2 - max(M[-1]))

Solution (Python):
import sys
n = int(input())
s = input()
t = input()
same_count = 0
for i in range(n):
    if s[n-1-i:] == t[:i+1]:
        same_count = i+1
print(2*n-same_count)

Solution (Python):




def main():
    N = int(input())
    s = input()
    t = input()

    for i in range(N, 0, -1):
        if s[-i:] == t[:i]:
            print(N*2-i)
            break
    else:
        print(N*2)


if __name__ == '__main__':
    main()

Solution (Python):
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)

Solution (Python):
import os,sys,random
n=int(input())
A=input();B=input()
for i in range(n,-1,-1):
	if A[n-i:]==B[:i]:
		print(n+n-i)
		break

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = str(input().rstrip('\n'))
    t = str(input().rstrip('\n'))
    l = n * 2
    for i in range(n):
        if s[-i-1:] == t[:i+1]:
            l = n * 2 - (i + 1)
    print(l)


if __name__ == '__main__':
    slove()

Solution (Python):
N=int(input())
s=input()
t=input()
ans=2*N
for i in reversed(range(1,N+1)):
    sl=s[-i:];tf=t[:i]

    if sl==tf:
        ans=2*N-i
        break
print(ans)

Solution (Python):
n=int(input())
s=list(input())
t=list(input())
ans=0
if s==t:
    ans=n
else:
    for i in range(n-1):
        if s[1+i:]==t[:n-1-i]:
            ans=n+(i+1)
            break
if ans==0:
    ans=n*2
print(ans)

Solution (Python):
N = int(input())
S = input()
T = input()

for start in range(N):
    for s, t in zip(S[start:], T[: N - start]):
        if s != t:
            break
    else:
        print(N + start)
        break
else:
    print(2 * N)

Solution (Python):
n =int(input())
s = list(input())
t =list(input())

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

Solution (Python):
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()

Solution (Python):
N=int(input())
S,T=input(),input()

cnt=0
for i in range(N):
  if S[i:]==T[:N-i]:
    cnt=N-i
    break
print(len(S)+len(T)-cnt)

Solution (Python):
N = int(input())
s = input()
t = input()

l = 0
for n in range(N, 0, -1):
    if s[N - n:] == t[:n]:
        l = n
        break
print(2 * N - l)

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

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

ans = 0
while S != T:
    S = S[1:]
    T = T[:-1]
    ans += 2
print(ans + len(S))

Solution (Python):
n=int(input())
s=input()
t=input()

for i in range(n+1)[::-1]:
    ss=s+t[i:]
    if((s in ss) and (t in ss)):
        print(len(ss))
        break

Solution (Python):
n=int(input())
s=input()
t=input()

fin=1
for i in range(n):
    flag=1
    j=0
    while i+j<n:
        if t[j]!=s[i+j]:
            flag=0
        j=j+1
    if flag and fin:
        print(n-i+i*2)
        fin=0
if fin:
    print(2*n)

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

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = str(input().rstrip('\n'))
    t = str(input().rstrip('\n'))
    mt = n * 2
    for i in range(n):
        ts = s[-i-1:]
        tt = t[:i+1]
        if ts == tt:
            mt = min(mt, n * 2 - (i + 1))
    print(mt)


if __name__ == '__main__':
    slove()

Solution (Python):
n=int(input())
s=input()
t=input()
a=s
for i in range(1,n+2):
    if t==a[-n:]:
        print(len(a))
        break
    a=s+t[-i:]

Solution (Python):
def resolve():
    n = int(input())
    s = input()
    t = input()
    overwrap = 0
    if s == t:
        print(n)
        return 0
    for i in range(1, n):
        if s[i:] == t[:-i]:
            overwrap = n - i
            break
    print(2 * n - overwrap)


if __name__ == "__main__":
    resolve()

Solution (Python):
import sys
input=sys.stdin.readline

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

def main():
    for i in range(N):
        if s[i:].find(t[0:N-i]) >= 0:
            print(2*N-(N-i))
            return
    print(N*2)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
s = input()
t = input()
n = 0
for i in reversed(range(N+1)):
  if s[-i:] == t[:i]:
    n = i
    break
r = 2*N-n
print(r)

Solution (Python):
import sys
from collections import defaultdict
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N,  = map(int, input().split())
A = list(input().strip())
B = list(input().strip())

for i in range(N):
    f = True
    t = A[i:i+N]
    for j in range(len(t)):
        if t[j] != B[j]:
            f = False
            break

    if f:
        print(N + i)
        exit()

print(N * 2)

Solution (Python):
def main():
    n = int(input())
    s = list(input())
    t = list(input())
    if s == t:
        print(n)
        exit()
    ans = float("inf")
    for i in range(n):
        S = s + t[i:]
        
        if S[:n] == s and S[2 * n - n - i:] == t:
            ans = min(ans, len(S))
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
s = list(input())
t = list(input())
count = 1000
for i in range(n):
         if s[i:] == t[:-i]:
                  count = i
if s == t:
         print(n)
elif count == 1000:
         print(2*n)
else:
         print(n + count)

Solution (Python):
N,S,T=int(input()),input(),input()
for i in range(N+1):
 if S[i:]==T[:N-i]:print(i+N);break

Solution (Python):
N=int(input())
S=input()
T=input()
for i in range(N+1):
  s = S+T[::-1][:i][::-1]
  if s[-N:]==T:print(N+i);break

Solution (Python):
n=int(input())
s=list(input())
t=list(input())
s.reverse() 
s_bottom=[]
t_head=[]
val=[n*2]
for i in range(n):
	s_bottom.append(s[i])
	t_head.append(t[i])
	s_bottom.reverse()
	if s_bottom!=t_head:
		s_bottom.reverse()
		continue
	else:
		val.append(n*2-len(t_head))
		
print(min(val))

Solution (Python):
N = int(input())
s = input()
t = input()
ans = 0
for i in range(1, N+1):
    if s[-i:] == t[:i]:
        ans = i
result = N+N-ans
print(result)

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

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

Solution (Python):
N=int(input())
s=input()
t=input()

c=0
for i in range(N):
    if s[i:]==t[:N-i]:
        c=N-i
        break

print(2*N-c)

Solution (Python):
N=int(input())
s=input()
t=input()

if s==t:
    print(N)
    exit()
c=0
for i in range(N):
    if s[i:]==t[:N-i]:
        c=N-i
        break

print(2*N-c)

Solution (Python):
N=int(input())
s=input()
t=input()

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

print(2*N-c)

Solution (Python):
n=int(input())
a=input()
b=input()
for i in range(n):
	cnt=0
	if a[i]==b[0]:
		j=i
		while j<n:
			if a[j]!=b[j-i]:
				break
			else:
				cnt+=1
				j+=1
	if cnt==n-i:
		print(n+i)
		exit()
print(n*2)

Solution (Python):
n=int(input())
s=list(input())
t=list(input())
ans=2*n
for i in range(n):
    if s[n-1-i:]==t[:i+1]:
        ans=2*n-(i+1)
print(ans)

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

Solution (Python):
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)

Solution (Python):
N = int(input())
s = input()
t = input()
num = 0

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

for i in range(1, N):
    if s[-i:] == t[:i]:
        num += 1 * i

print(N * 2 - num)

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = str(input().rstrip('\n'))
    t = str(input().rstrip('\n'))
    a = len(s) + len(t)
    for i in range(n):
        if s[-i-1:] == t[:i+1]:
            a = len(s) + len(t) - len(t[:i+1])
    print(a)


if __name__ == '__main__':
    slove()

Solution (Python):
n = int(input())
s = input()
t = input()

for _ in range(n):
  if s == t:
    break
  else:
    s = s[1:]
    t = t[:-1]

print(n*2-len(s))

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
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 LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    n = I()
    s = input()
    t = input()
    ans = 2*n
    for i in range(n)[::-1]:
        su = s[i:]
        pre = t[:n-i]
        if su == pre:
            ans = n+i
    print(ans)
    return


def B():

    return


def C():

    return


def D():

    return


def E():

    return


def F():

    return


if __name__ == "__main__":
    A()