+ محدودیت زمان: ۱ ثانیه
+ محدودیت حافظه: ۲۵۶ مگابایت
----------
Ehsan has been invited to Ramtin’s birthday party, where he knows there will be a lot of drinks, food, and games to socialize with friends. Ramtin has a lot of games to play with, but as a good computer teacher, his games are mostly designed to test how good his students are at problem-solving. Often, in these games, one is required to be able to find a solution to a problem and to be quick in doing it.
For fairness sake, Ramtin let Ehsan pick today’s game, and so they all started playing. At the beginning of the game, there is a black box from which every participant randomly picks a string $s_i$ Once every one of the $n$ participants has chosen their string, they have to try to pair them up with each other’s string, attempting to create palindromes while doing so.
More specifically, they can choose any $s_i$ and $s_j$($i \neq j$) and attempt to concatenate them to make a palindrome string. The winner of the game is the fastest person who finds the exact number of ways they can create a palindrome string among all possible pairs.
Help Ehsan win the game by writing an algorithm that, given $n$ unique strings, calculates the number of ways a palindrome string can be constructed!
# input
The first line contains one integer $n$, the number of players. Each of the next $n$ lines contains a string $s_i$, the string chosen by the $i$-th player.
$$2 \leq n \leq 10^4$$
$$1 \leq |s_i| \leq 600$$
+ Each string is unique
+ Each string is always formed by lowercase English letters
# output
You need to write a single line containing the number of ways we can create a palindrome string.
# example
### sample input 1
```
5
abcd
dcba
lls
s
sssll
```
### sample output 1
```
4
```
### sample input 2
```
3
bat
tab
cat
```
### sample output 2
```
2
```
ارسال پاسخ برای این سؤال
در حال حاضر شما دسترسی ندارید.