| Codeforces Round 1107 (Div. 3) |
|---|
| Finished |
You are given a binary string $$$s$$$ consisting only of the characters $$$\texttt{0}$$$ and $$$\texttt{1}$$$.
In one operation, you can do the following:
The remaining parts of the string are then concatenated to form the new string $$$s$$$.
Find the minimum possible length of the string $$$s$$$ that can be achieved after applying this operation any number of times (possibly zero).
$$$^{\text{∗}}$$$A string $$$a$$$ is a substring of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by the deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
$$$^{\text{†}}$$$A string $$$a$$$ of length $$$m$$$ is said to be palindrome if $$$a_i = a_{m + 1 - i}$$$ for all $$$1 \le i \le m$$$.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of each test case follows.
The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the binary string $$$s$$$.
The second line of each test case contains a binary string $$$s$$$ of length $$$n$$$. It is guaranteed that each character of $$$s$$$ is either $$$\texttt{0}$$$ or $$$\texttt{1}$$$.
For each test case, print the minimum possible length of the string $$$s$$$ that can be achieved after applying the operation any number of times.
440000311061100116101100
1211
In the first test case, the initial string is $$$\texttt{0000}$$$. We can perform the following sequence of operations:
In the second test case, the initial string is $$$\texttt{110}$$$.
| Name |
|---|


