CF1800F.Dasha and Nightmares
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Dasha, an excellent student, is studying at the best mathematical lyceum in the country. Recently, a mysterious stranger brought n words consisting of small latin letters s1,s2,…,sn to the lyceum. Since that day, Dasha has been tormented by nightmares.
Consider some pair of integers ⟨i,j⟩ ( 1≤i≤j≤n ). A nightmare is a string for which it is true:
- It is obtained by concatenation sisj ;
- Its length is odd;
- The number of different letters in it is exactly 25 ;
- The number of occurrences of each letter that is in the word is odd.
For example, if si= "abcdefg" and sj= "ijklmnopqrstuvwxyz", the pair ⟨i,j⟩ creates a nightmare.
Dasha will stop having nightmares if she counts their number. There are too many nightmares, so Dasha needs your help. Count the number of different nightmares.
Nightmares are called different if the corresponding pairs ⟨i,j⟩ are different. The pairs ⟨i1,j1⟩ and ⟨i2,j2⟩ are called different if i1=i2 or j1=j2 .
输入格式
The first line contains a single integer n ( 1≤n≤2⋅105 ) — the number of words.
The following n lines contain the words s1,s2,…,sn , consisting of small latin letters.
It is guaranteed that the total length of words does not exceed 5⋅106 .
输出格式
Print a single integer — the number of different nightmares.
输入输出样例
输入#1
10 ftl abcdefghijklmnopqrstuvwxy abcdeffghijkllmnopqrsttuvwxy ffftl aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyy thedevid bcdefghhiiiijklmnopqrsuwxyz gorillasilverback abcdefg ijklmnopqrstuvwxyz
输出#1
5
说明/提示
In the first test, nightmares are created by pairs ⟨1,3⟩ , ⟨2,5⟩ , ⟨3,4⟩ , ⟨6,7⟩ , ⟨9,10⟩ .