시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 256 MB333100.000%

문제

Some power influenced Rikka to stand LCR up. Is it a coincidence that LCR brought her to the middle school attached to the EC Final host?

Rikka is trying to enter the NWPU, but the guard who has been possessed by the devil doesn't let her in. Now she has an idea of forging a pass.

The key is the pass ID, a special string for access-handshaking. The guard has a string $s$ of length $n$ as the secret key; when he checks a pass, he chooses a suffix of it (that is, a substring containing the last character), and calculates the length $l$ of the longest common prefix of the pass ID and the suffix. $l$ is proportion to the probability to let her pass.

Now Rikka has got the secret key in some secret way. She wants to choose a suffix as the pass ID, too. Since the suffix which the guard will choose is unknown, Rikka would choose her pass ID randomly. That is, Rikka would design a probability distribution for the suffixes (i.e. a series of real numbers $\{p_i\}, i = 1, 2, \dots , n$, such that $p_i \ge 0, \sum_{i=1}^n p_i = 1$, which means she would choose the suffix of length $i$, denoted by $s_i$, with a probability of $p_i$), and maximize the minimum mathematical expectation of $l$ for any suffix the guard chooses.

Could you please calculate the maximum value of the minimum mathematical expectation of $l$? Precisely speaking, what you should calculate is $$\max_{\{p_i\}} \left(\min_{j=1}^n\left(\sum_{k=1}^n p_k \mathrm{lcp}(s_k,s_j)\right)\right),$$ where $\mathrm{lcp}(s_k,s_j)$ means the length of longest common prefix of $s_k$ and $s_j$.

입력

The first line contains one integer $T (1 \leq T \leq 10^5)$, the number of test cases. Then $T$ test cases follow.

Each test case contains a string $s$ of length $n (1 \leq n \leq 2 \times 10^5)$, consisting of only lowercase letters, the secret key.

It is guaranteed that the sum of $n$ in all test cases is at most $5 \times 10^5$.

출력

Output $T$ lines; each line contains a decimal number, the answer to that test case.

Your answer is considered correct if the absolute or relative error doesn't exceed $10^{-9}$.

예제 입력 1

3
aba
aaaaaaaaaaa
abcd

예제 출력 1

0.66666666667
1
0.48