No.2737 Compound Word
問題文最終更新日: 2024-04-19 01:07:17
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
CPCTF 2024 : PPC
(順位表)
の他の問題:
Problem Statement
You are given $N$ strings $S_1, S_2 ,\cdots, S_N$.
Choose two different strings $S_i, S_j $ among them, and let $T$ be the string obtained by concatenating them in the order $S_iS_j$.
Find the number of distinct strings that $T$ can be.
Constraints
- $N$ is an integer.
- $2 \leq N \leq 50$
- $S_i$ is a string consisting of lowercase English letters.
- $1 \leq |S_i| \leq 100$
- $S_i \ne S_j$ $(i\ne j)$
- $\sum_{i=1}^{N} |S_i| \leq 300$
Input
The input is given from Standard Input in the following format.
$N$ $S_1$ $\vdots$ $S_N$
Output
Output the answer.
Sample
Sample 1
Input
2 pon juice
Output
2
The $2$ words ponjuice and juicepon can be made, so output 2.
Sample 2
Input
2 pon ponpon
Output
1
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。