Given a long string
Constraints
The sum of the lengths of the
Input Specification
The first line of input contains a single integer
The second line of input contains the string
The third line of input contains a single integer
The next
Output Specification
Output the number of characters contained in at least two words.
Sample Input 1
8
aabcdefg
4
aa
abc
def
ef
Sample Output 1
3
Sample Explanation 1
The overlapping characters are shown in blue below.
Sample Input 2
16
fafelmasfelimsdf
5
fa
felim
m
ef
kenneth
Sample Output 2
1
Sample Explanation 2
The only overlapping letter is "m", the overlap from "felim" and "m".
Sample Input 3
3
aaa
1
aa
Sample Output 3
1
Sample Explanation 3
The middle "a" is overlapped by the two "aa".
Comments