#K89072. Count Concatenation Pairs
Count Concatenation Pairs
Count Concatenation Pairs
Given a list of strings and a target string \( s \), count the number of ordered pairs of distinct indices \( (i, j) \) such that the concatenation of the string at index \( i \) and the string at index \( j \) equals \( s \). In other words, you need to count the number of pairs \( (i, j) \) with \( i \neq j \) where:
\( \texttt{lst}[i] + \texttt{lst}[j] = s \)
The input is provided via standard input and the output should be printed to standard output.
inputFormat
The first line of input contains a single integer \( n \) representing the number of strings in the list.
The second line contains \( n \) space-separated non-empty strings. If \( n = 0 \), this line will be skipped.
The third line contains the target string \( s \).
outputFormat
Output a single integer, the number of pairs of distinct indices \( (i, j) \) such that the concatenation of \( \texttt{lst}[i] \) and \( \texttt{lst}[j] \) equals \( s \).
## sample5
ab c abc de cde
abcde
2
</p>