atcoder#AGC006A. [AGC006A] Prefix and Suffix

[AGC006A] Prefix and Suffix

Score : 200200 points

Problem Statement

Snuke is interested in strings that satisfy the following conditions:

  • The length of the string is at least NN.
  • The first NN characters equal to the string ss.
  • The last NN characters equal to the string tt.

Find the length of the shortest string that satisfies the conditions.

Constraints

  • 1N1001 \leq N \leq 100
  • The lengths of ss and tt are both NN.
  • ss and tt consist of lowercase English letters.

Input

The input is given from Standard Input in the following format:

NN

ss

tt

Output

Print the length of the shortest string that satisfies the conditions.

3
abc
cde
5

The shortest string is abcde.

1
a
z
2

The shortest string is az.

4
expr
expr
4

The shortest string is expr.