Problem: Did you think there was going to be a JoJo legend here? But no, that was me, Dio!
Given a binary string of length , consisting of characters 0 and 1. Let's build a square table of size , consisting of 0 and 1 characters as follows.
In the first row of the table write the original string . In the second row of the table write cyclic shift of the string by one to the right. In the third row of the table, write the cyclic shift of line by two to the right. And so on. Thus, the row with number will contain a cyclic shift of string by to the right. The rows are numbered from to top-to-bottom.
In the resulting table we need to find the rectangle consisting only of ones that has the largest area.
We call a rectangle the set of all cells in the table, such that and for some integers and .
Recall that the cyclic shift of string by to the right is the string . For example, the cyclic shift of the string "01011" by to the right is the string itself "01011", its cyclic shift by to the right is the string "01101".
Input Format: Each test consists of multiple test cases. The first line contains a single integer () — the number of test cases. The description of test cases follows.
The first and the only line of each test case contains a single binary string (), consisting of characters 0 and 1.
It is guaranteed that the sum of string lengths over all test cases does not exceed .
Output Format: For each test case, output a single integer — the maximum area of a rectangle consisting only of ones. If there is no such rectangle, output .
Note: In the first test case, there is a table consisting of a single character 0, so there are no rectangles consisting of ones, and the answer is .
In the second test case, there is a table , consisting of a single character 1, so the answer is .
In the third test case, there is a table:
101110011
In the fourth test case, there is a table:
011110001111100111110011111001111100
In the fifth test case, there is a table:
101010010101101010010101101010010101
Rectangles with maximum area are shown in bold.