#agc006a. [agc006_a]Prefix and Suffix
[agc006_a]Prefix and Suffix
Problem Statement
Snuke is interested in strings that satisfy the following conditions:
- The length of the string is at least .
- The first characters equal to the string .
- The last characters equal to the string .
Find the length of the shortest string that satisfies the conditions.
Constraints
- The lengths of and are both .
- and consist of lowercase English letters.
Input
The input is given from Standard Input in the following format:
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
.