atcoder#AGC006A. [AGC006A] Prefix and Suffix
[AGC006A] Prefix and Suffix
Score : points
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.
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
.