Boring Marathon
Practice
2.7 (3 votes)
Mathematics
Easy Medium
Probability distribution
Probability distribution
Problem
69% Success 1585 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Chintu was part of the Lolympics committee. He had a day off today, so, Chintu decided to watch the 42 km Marathon Finals with Mintu. They started to feel bored after a few minutes. So, they decided to play a game.

They decided a string of length L, and wrote the same string on their respective papers. The string consisted of only upper case letters. Once both of them had a paper with the same string, they started to pick a character from the mentioned string and match if it was same or not. Once an element of a string was picked, they discarded that from their respective strings.

You've to calculate the expected number of times the character both of them picked is same.

Input:
A single line consisting of a number T denoting the number of test cases.
Next T lines consisting of a string of length L having upper case letters.

Output:
Print the expected value upto six decimal places.

Constraints:
1 <= T <= 10
1 <= L <= 105

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
No similar problems found