Palin Pairs
Practice
3.6 (369 votes)
Ad Hoc
String algorithms
Hash function
Easy
Very easy
Problem
72% Success 7571 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Panda has a thing for palindromes. Hence he was a given a problem by his master. The master will give Panda an array of strings S having N strings. Now Panda has to select the Palin Pairs from the given strings .

A Palin Pair is defined as :

\((i,j\)) is a Palin Pair if Si = reverse(Sj) and \(i < j\)

Panda wants to know how many such Palin Pairs are there in S.
Please help him in calculating this.

Input:

The first line contains N, the number of strings present in S.
Then N strings follow.

Output:

Output the query of Panda in single line.

Constraints:

1N\(100000\)
1|Si|\(10\) (length of string)

The string consists of Upper and Lower case alphabets only.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
10 votes
Tags:
StringImplementationRecruitBasic ProgrammingAlgorithmsEasyString AlgorithmsApprovedHashing algorithmHashing algorithm
Points:20
7 votes
Tags:
Hash functionEasyStringHashing algorithm
Points:20
1 votes
Tags:
Easy