AtCoder Grand Contest 006
A
Prefix and Suffix
AtCoder
⌀ 516
原题
←B →
翻译中…

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.

翻译中…

样例

Input #1
3
abc
cde
Output #1
5
The shortest string is `abcde`.
Input #2
1
a
z
Output #2
2
The shortest string is `az`.
Input #3
4
expr
expr
Output #3
4
The shortest string is `expr`.
题目信息
题号
agc006_a
时间限制
2 s
内存限制
256 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。