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):
N = int(input())
s = input()
t = input()
for K in range(N):
    flag = 1
    for i in range(N-K):
        if s[i+K]!=t[i]:
            flag = 0
            break
    if flag == 1:
        print(N+K)
        exit()
print(2*N)

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

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

Solution (Python):

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

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

print(ans)

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

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

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

k = 0

for i in range(N):
    for j in range(N):
        s = S[i:]
        t = T[:j + 1]
        if s == t:
            k = max(k, len(s))

print(2 * N - k)

Solution (Python):





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

    len_common = N
    for i in range(N):
        sub = S[i:]
        if T.startswith(sub):
            break
        len_common -= 1

    print(len(S) + len(T) - len_common)

if __name__ == "__main__": main()

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


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

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


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
s = input()
t = input()
if s == t:
    print(len(s))


else:
    ans = N * 2
    for i in range(N):
        a = s[:i] + t
        if a[:N] == s:
            ans = min(ans, len(a))

        a = s + t[i:]
        if a[N:] == t:
            ans = min(ans, len(a))

    print(ans)

Solution (Python):

import itertools
n = int(input())
s = input()
t = input()
for l in itertools.count(n):
    it = (s + 'a' * l)[: l - len(t)] + t
    if len(it) >= n and it.startswith(s) and it.endswith(t):
        break
print(len(it))

Solution (Python):
def prefix_and_suffix():
	n = int(raw_input())
	s = str(raw_input())
	t = str(raw_input())
	
	for i in range(n):
		sub_s = s[i:]
		sub_t = t[:n-i]
		if sub_s==sub_t:
			print n+i
			return
	print 2*n

if __name__ == "__main__":
	prefix_and_suffix()

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

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

Solution (Python):
import sys
N = int(input())
s = str(input())
t = str(input())


length = len(s) + len(t)
if (N >= (length)):
  print(N)
  sys.exit()


min_a = t if (len(s) > len(t)) else s
max_b = s if (len(s) > len(t)) else t

cnt = 0
j = 0

for i in range(len(min_a)):
  touch = False
  k = 0
  for j in range(i, len(min_a)):
    
    if (min_a[j] == max_b[k]):
      k += 1
      cnt += 1
    else:
      touch = True
      cnt = 0
      break
  if(touch == False):
      break

print(max(length - cnt, N))

Solution (Python):
import sys
if __name__ == "__main__":
    N = int(input())
    S = input()
    T = input()
    for i in range(N):
        left = 0
        ok = True
        for j in range(i, N):
            if (S[j] == T[left]):
                left += 1
            else:
                ok = False
        if (ok):
            print (N + i)
            sys.exit()
    print (2 * N)

Solution (Python):

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))

Solution (Python):
import sys
if __name__ == '__main__':
    N = int(input())
    s = input()
    t = input()
    S = []
    for i in range(N+1):
        tmp = s + t[i:]
        S.append(tmp)
    mini = 1000000
    for l in S:
        if l[-N:] == t:
            mini = min(mini,len(l))
    print(mini)

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

Solution (Python):
i=raw_input;N=n=int(i());s,l,j=i(),i(),0;
exec "j=max(n*(s[-n:]==l[:n]),j);n-=1;"*N;
print 2*N-j

Solution (Python):
i=input;N=int(i());s=i();l=i();n=N;j=0
exec("j=max(n*(s[-n:]==l[:n]),j);n-=1;"*N);print(2*N-j)

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

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

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

Solution (Python):
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 (len(s + u))

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

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 = min(ans, 2 * N - i)
print(ans)

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

idx = 0
a = []
b = []

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

for i in range(1, n+1):
    for j in range(1, i):
        a += s[n-i+j]
        b += t[j-1]
    if(a == b): idx = i-1
    a = []
    b = []

if(s == t):
    print(n)
else:
    print(n*2-idx)

Solution (Python):
n=int(raw_input())
s=raw_input()
t=raw_input()
for i in range(n+1):

 if s[i:]==t[:n-i]:
  print n+i
  break

Solution (Python):



from __future__ import division, print_function, absolute_import, unicode_literals

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

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

if len(s) + len(t) - correspoint_cnt < N:
    print(N)
else:
    print(len(s) + len(t) - correspoint_cnt)

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

Solution (Python):

import itertools
n = int(input())
s = input()
t = input()
for l in itertools.count(n):
    it = (s + 'a' * l)[: l - len(t)] + t
    if len(it) >= n and it.startswith(s) and it.endswith(t):
        break
print(len(it))

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

Solution (Python):
def Main():
    n = int(input())
    a = input()
    b = input()
    x = 0
    y = 0
    for i in range(len(a)):
        if a[i] == b[x]:
            x += 1
            y += 1

    print(len(a[0:n - y]) + len(b))

if __name__ == '__main__':
    Main()

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    n = int(input())
    s = input()
    t = input()
    r = len(s)+len(t)
    sl = len(s)
    tl = len(t)
    for i in range(len(s)):
        if i + tl < n:
            continue
        if s[i:] == t[:sl-i]:
            r = i + tl
            break

    return max(r,n)


print(f())

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

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

Solution (Python):
i=n=input()
p=raw_input
s=p()
t=p()
while(s[-i:]!=t[:i])*i:i-=1
print 2*n-i

Solution (Python):
n = int(input())
s = str(input())
t = str(input())
i = -1
while True:
   i += 1
   if t.find(s[i:n])>-1:
      print(int(n+i))
      break

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

Solution (Python):
n=input()
s=raw_input()
t=raw_input()
for i in xrange(0,n+1):
	if s[i:n]==t[0:n-i]:
		print n+i
		break

Solution (Python):

n = int(input())
s = input()
t = input()
txt = s+t
tmp = ''

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

if s==t:
    print(len(s))
else :
    print(len(txt))

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


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

print 2*N-ans

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

Solution (Python):


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

combined = ""
a = [x for x in range(N+1)]
a.reverse()
for i in a:
	if s[N-i:] == t[:i]:
		combined = s[:]+t[i:]
		break
print(len(combined))

Solution (Python):
N = int(input())
s = input()
t = input()
mx = 0
for i in range(0,N):
    cnt = 0
    for j in range(0,N):
        if i+j >= N: break
        if s[i+j] == t[j]:
            cnt += 1
    mx = max(mx,cnt)
print(len(s+t[mx:]))

Solution (Python):


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

length = N*2

i = 1
MAX = 0
while i <= N:
   
    cs =  t[0:i]
    ct = s[N-i:N]
    
    
    
    
    if cs == ct:
        MAX = i 
    else:
        next
    i+=1

print N*2-MAX

Solution (Python):
import sys
n=input()
s=input()
t=input()
count=0
flag=True
for i in range(len(s)):
    flag=True
    j=0
    for ii in range(i,len(s)):
        if t[j]!=s[ii]:
            flag=False
            break
        j+=1
        count+=1
    if flag:
        print(len(s)+i)
        sys.exit()
print(len(s+t))

Solution (Python):


from __future__ import absolute_import
from __future__ import unicode_literals
import sys

n = int(input())
before = str(input())
after = str(input())
cnt = n

while True:
    if cnt == 0:
        print(len(before) + len(after) - cnt)
        break
    start = after[:cnt]
    last = before[-cnt:]
    if last == start:
        print(len(before) + len(after) - cnt)
        break
    cnt -= 1

Solution (Python):


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

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


print(res)

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

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

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

if s == t:
    print(len(s))
else:
    while len(another_t) != 0:
        string = s + another_t
        if string[0:N] == s and string[len(string)-N:len(string)] == t:
            ans = len(string)
        another_t = another_t[1:len(another_t)]
    print(ans)

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

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

for i in range(n + 1):
    sp = s[i:n]
    tp = t[0:n-i]
    if sp != tp:
        continue
    print(n+i)
    break

Solution (Python):
N = int(input())
s = list(input())
t = list(input())
for i in range(0,N):
    
    if s[i:]==t[:N-i]:
        s = s[:i]
        break
s.extend(t)
print(len(s))

Solution (Python):
n = int(input())
s = str(input())
t = str(input())
s_rev = s[::-1]
count = 0

for i in range(1, n+1):
    sub_str = (s_rev[0:i])[::-1]
    if t[0:i] == sub_str and t[0:i][0] == sub_str[0]:
        count = max(count, len(sub_str))
print((2*n) - count)

Solution (Python):
def main():
    minLen = int(input())
    begin = list(input())
    end = list(input())

    iMax = 0

    if begin == end:
        iMax = minLen
    else:
        for i in range(minLen):
            if i == 0: continue
            if begin[-i:] == end[:i]: iMax = i
            

    print(2*minLen - iMax)

    

if __name__ == '__main__':
  main()

Solution (Python):
n = input()
s = raw_input()
t = raw_input()
count = 0
while(count < n):
	if s[count:n] == t[0:n-count]:
		print n + count
		exit()
	count += 1
print n*2

Solution (Python):
n = int(raw_input())
s = raw_input().strip()
t = raw_input().strip()
ans = 2 * n
for i in xrange(n):
    if s[i:] == t[:n-i]:
        ans = min(ans, n + i)
print ans

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

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

print(2 * N - same_len)

Solution (Python):

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

	print(len(s)*2-memo)

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

Solution (Python):
import sys

N = int(input())

a = input()
b = input()

for i in range(N):
	if a[i:N] == b[0:N-i]:
		print(N+i)
		sys.exit()
		
print(2 * N)

Solution (Python):




"""









"""
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import

def read_input():
    min_len = int(input())
    first_str = list(input())
    end_str = list(input())

    return min_len, first_str, end_str


def check_dup(first_str, end_str, min_len):
    """

    >>> check_dup("expr", "expr", 4)
    4
    >>> check_dup("a", "z", 1)
    2
    >>> check_dup("abc", "cde", 3)
    5
    >>> check_dup("expr", "expr", 5)
    8
    """
    for char_num in range(len(end_str), 0, -1):
        sub_f = first_str[char_num * -1:]
        sub_e = end_str[: char_num]

        if sub_f == sub_e:
            result = len(sub_f) + (len(end_str) - char_num) * 2
            if result < min_len:
                continue
            else:
                return result

    return len(first_str) + len(end_str)



if __name__ == "__main__":
    
    

    min_len, f, e = read_input()

    print(check_dup(f, e, min_len))

Solution (Python):
def func():
 n=int(input())
 a=input()
 b=input()
 for i in range(n,0,-1):
  if(a[-i:]==b[0:i]):
   print(n*2-i)
   return
 print(n*2)

func()

Solution (Python):








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

ans = 2 * n
for i in range(n):
	flag = True
	for j in range(n-i):
		if s[i+j] != t[j]:
			flag = False
			break
	if flag:
		ans = n + i
		break
print(ans)

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

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

Solution (Python):
n = input()
s = raw_input()
t = raw_input()
u = s[:]
i = 1
while True:
    
    if u[-n:] == t:
        break
    else:
        u = s + t[-i:]
        i += 1
print len(u)

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



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

print z

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

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

if s == t:
    print(N)
else:
    print(2 * N - k)

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

for i in xrange(2*N):
    if s in s[0:i]+t:
        print N + i
        break

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

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



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



print 2*N-d

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

for i in range(N):
    flg = True
    for j in range(i,N):
        if s[j] != t[j-i]:
            flg = False
            break
    if flg:
        print N+i
        exit()
print 2*N

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

def calc():
    for i in range(len(s)):
        if re.match(s[i:],t):
            return n+i
    return n*2
print(calc())

Solution (Python):

"""
Created on Sat Oct 29 21:00:35 2016

@author: dotha
"""

def main():
    N = int(input())
    s = input()
    t = input()
    if s==t:
        return s
    for i in range(N):
        if s[i:] == t[:-i]:
            return(s[:i]+t)
    else:
        return(s+t)
    





if __name__ == "__main__":
    print(len(main()))

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

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

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

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

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

Solution (Python):



def length_of_shotest_string(n, s, t):
    for i in range(n + 1)[::-1]:
        if s.endswith(t[:i]):
            return 2 * n - i


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


if __name__ == '__main__':
    main()

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

Solution (Python):
a, s, t = input(), raw_input(), raw_input()
for i in xrange(a):
    if s[i:] == t[:a-i]:
        print a+i
        exit()
print a*2

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

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

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

Solution (Python):
N = int(raw_input())                                                                        
s = raw_input()                                                                             
t = raw_input()                                                                             
                                                                                            
count = 0                                                                                   
for i in xrange(N):                                                                         
    if s[i] == t[count]:                                                                    
        count += 1                                                                          
print 2*N - count

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

Solution (Python):

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys

def s():
    return raw_input().strip()
def n():
    return int(raw_input())
def d():
    return float(raw_input())

def ls():
    return raw_input().strip().split()
def ln():
    return map(int, raw_input().strip().split())
def ld():
    return map(float, raw_input().strip().split())

def fs():
    return [raw_input().strip() for i in xrange(input())]
def fn():
    return [int(raw_input().strip()) for i in xrange(input())]
def fd():
    return [float(raw_input().strip()) for i in xrange(input())]

N = n()
S = s()
T = s()

LS = len(S)
LT = len(T)

for i in xrange(LS):
    if i + LT >= N and S[i:] == T[:LS - i]:
        print i + LT
        break
else:
    print LS + LT

Solution (Python):
n=int(raw_input())
s=raw_input()
t=raw_input()
j=0
while s[j:]!=t[:n-j]:j+=1
print n+j

Solution (Python):


n = int(raw_input())

a = raw_input()
b = raw_input()

res = n

for i in xrange(n):
    if a.endswith(b[:n-i]):
        break
    res += 1

print res

Solution (Python):



def rl(s): return xrange(len(s))


INF = 2147483647


import sys
stdin = sys.stdin

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

for offset in range(N+1):
    if t.startswith(s[offset:]):
        print N + offset
        break

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

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):

import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

N = int(raw_input())
s = raw_input()
t = raw_input()

for i in xrange(len(s)):
    for j in xrange(len(t)):
        if i + j >= len(s): continue
        if t[j] != s[i + j]:
            break
    else:
        print i + j + 1
        exit()
print len(s) + len(t)

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

Solution (Python):
N, s, t = int(input()), input(), input()
m = N
while N > 0 and s[-N:] != t[:N]:
    N -= 1
print(m * 2 - N)