[POI2006]Pal

时间限制:5s      空间限制:357MB

题目描述

给出n个回文串s1, s2, …, sn 求如下二元组(i, j)的个数 si + sj 仍然是回文串 规模 输入串总长不超过2M bytes


输入格式

The first line of input file contains the number of strings n. The following n lines describe each string: The i+1-th line contains the length of the i-th string li, then a single space and a string of li small letters of English alphabet. You can assume that the total length of all strings will not exceed 2,000,000. Two strings in different line may be the same.


输出格式

Print out only one integer, the number of palindromes


样例输入

6 
2 aa 
3 aba 
3 aaa 
6 abaaba 
5 aaaaa 
4 abba


样例输出

14

提示

没有写明提示


题目来源

没有写明来源

Menuappsclose