Welcome to the XVII Annual Drone Kaleidoscope (DK for short)! A one-lane track is written as a string $$$s$$$ of $$$n$$$ lowercase characters.
During the annual DK, several teams, one by one, perform a show as follow:
A team's show value is $$$$$$ \text{(length of its palindrome)} \times \text{(number of drones it places)}. $$$$$$
Choose how many teams to field (each using a distinct palindrome) and, for each chosen team, pick the starting positions of its drones so as to maximize the total show value across all shows.
For example, if we have $$$s=abaaba$$$ and k=3, a valid show configuration is to field $$$3$$$ teams as follows:
The total show value in this example is $$$6+4+2=12$$$. Note that this is not the configuration that maximizes the total show value.
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases.
The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1\leq n \leq 10^5$$$ and $$$1 \leq k \leq n$$$) — the length of string $$$s$$$ and the parameter $$$k$$$ described in the statements.
The following line contains a string $$$s$$$ of length $$$n$$$ consisting only of English lowercase characters.
The sum of $$$n$$$ over all test cases is guaranteed to be at most $$$10^5$$$.
Print one integer for each test case — the maximum total show value you can achieve.
47 2abacaba7 4abacaba7 6abacaba6 3abaaba
28 26 22 22