/**
* ! @Author : - Mohammed Murshedur Rahman
* ? Date & Time : - 2024-11-05 21:00
* * BANGLADESH : - SYLHET
*/
#include <stdio.h>
#include <string.h>
int maxValue(char* s, int n)
{
int max1 = 0;
int max2 = 0;
for (int i = 0; i < n; i++)
{
if (s[i] == '1')
{
max2++;
if (max1 < max2)
{
max1 = max2;
}
}
else
{
max2 = 0;
}
}
return max1;
}
void solve()
{
int n;
scanf("%d", &n);
char s[n+1];
scanf("%s", s);
int max_ones = maxValue(s, n);
printf("%d\n", max_ones);
}
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
solve();
}
return 0;
}