#agc047b. [agc047_b]First Second
[agc047_b]First Second
Problem Statement
Limak can repeatedly remove one of the first two characters of a string, for example $abcxyx \\rightarrow acxyx \\rightarrow cxyx \\rightarrow cyx$.
You are given different strings . Among pairs , in how many pairs could Limak obtain one string from the other?
Constraints
- consists of lowercase English letters
a
-z
.
Input
Input is given from Standard Input in the following format.
Output
Print the number of unordered pairs where and Limak can obtain one string from the other.
Sample Input 1
3
abcxyx
cyx
abc
Sample Output 1
1
The only good pair is .
Sample Input 2
6
b
a
abc
c
d
ab
Sample Output 2
5
There are five good pairs: , , , , .