Program walrus;
var
N, S, T, W, test,i, singolo, blocco, totdormienti, maxtempo: LongInt;
C : AnsiString;
branco, tempobranco:array[1..300000] of longint;
Procedure calcolatempo(B:longint; var tempo:longint) ;
begin
if B=1 then tempo:=1
else if B=2 then tempo:=2
else
begin
if B mod 2<>0 then tempo := (B-3) div 2 +2
else tempo:= (B-3) div 2 +3;
end;
end;
begin
(*assign(input, 'input.txt'); reset(input);
assign(output, 'output.txt'); rewrite(output);*)
ReadLn(T);
for test:=1 to T do begin
ReadLn(N);
ReadLn(C);
W := 0;
S := 0;
singolo:=0;
blocco:=0;
totdormienti:=0;
i:=1;
while i<N do
begin
if C[i]='-' then begin if ((i=N-1) and (C[i+1]='.')) then begin blocco:=blocco+1; totdormienti:=totdormienti+1; branco[blocco]:=totdormienti; i:=i+1; totdormienti:=0;end
else i:=i+1;
end
else
if (C[i]='.') and (C[i+1]='.') then begin if i=N-1 then begin blocco:=blocco+1; totdormienti:=totdormienti+2; branco[blocco]:=totdormienti; i:=i+1; end
else begin i:=i+1; totdormienti:=totdormienti+1; end
end
else
if (C[i]='.') and (C[i-1]='-') and (C[i+1]='-') then begin singolo:=singolo+1; blocco:=blocco+1;totdormienti:=totdormienti+1; branco[blocco]:=totdormienti; i:=i+1; totdormienti:=0;end
else
if (C[i]='.') and (C[i+1]='-') then begin blocco:=blocco+1;totdormienti:=totdormienti+1;branco[blocco]:=totdormienti; i:=i+1; totdormienti:=0; end;
end;
maxtempo:=0;
for i:=1 to blocco do begin calcolatempo(branco[i],tempobranco[i]); if tempobranco[i]>maxtempo then maxtempo:= tempobranco[i]; end;
W:=blocco;
if blocco=1 then S:=tempobranco[1]
else if maxtempo>blocco then S:=maxtempo
else begin if singolo=0 then S:=blocco+1
else S:=blocco;
end;
WriteLn(W, ' ', S);
end;
end.
UHJvZ3JhbSB3YWxydXM7CnZhcgogICAgTiwgUywgVCwgVywgdGVzdCxpLCBzaW5nb2xvLCBibG9jY28sIHRvdGRvcm1pZW50aSwgbWF4dGVtcG86IExvbmdJbnQ7CiAgICBDICAgICAgICAgICAgICAgIDogQW5zaVN0cmluZzsKICAgIGJyYW5jbywgdGVtcG9icmFuY286YXJyYXlbMS4uMzAwMDAwXSBvZiBsb25naW50OwoKUHJvY2VkdXJlIGNhbGNvbGF0ZW1wbyhCOmxvbmdpbnQ7IHZhciB0ZW1wbzpsb25naW50KSAgOwpiZWdpbgogIGlmIEI9MSB0aGVuIHRlbXBvOj0xCiAgICAgICAgIGVsc2UgaWYgQj0yIHRoZW4gdGVtcG86PTIKICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgIGJlZ2luCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIEIgbW9kIDI8PjAgdGhlbiB0ZW1wbyA6PSAoQi0zKSBkaXYgMiArMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHRlbXBvOj0gIChCLTMpIGRpdiAyICszOwogICAgICAgICAgICAgICAgICAgICAgIGVuZDsgICAgICAgICAgICAgICAgCmVuZDsKICAgIAogICAgCmJlZ2luCiAgICAoKmFzc2lnbihpbnB1dCwgICdpbnB1dC50eHQnKTsgIHJlc2V0KGlucHV0KTsKICAgIGFzc2lnbihvdXRwdXQsICdvdXRwdXQudHh0Jyk7IHJld3JpdGUob3V0cHV0KTsqKQogICAgUmVhZExuKFQpOwogICAgZm9yIHRlc3Q6PTEgdG8gVCBkbyBiZWdpbgogICAgICAgIFJlYWRMbihOKTsKICAgICAgICBSZWFkTG4oQyk7CiAgICAgICAgVyA6PSAwOwogICAgICAgIFMgOj0gMDsKICAgICAgICBzaW5nb2xvOj0wOwogICAgICAgIGJsb2Njbzo9MDsKICAgICAgICB0b3Rkb3JtaWVudGk6PTA7CiAgICAgICAgaTo9MTsgCiAgICAgICAgd2hpbGUgaTxOIGRvIAogICAgICAgICAgICAgICAgICAgIGJlZ2luCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIENbaV09Jy0nICB0aGVuIGJlZ2luICBpZiAoKGk9Ti0xKSBhbmQgKENbaSsxXT0nLicpKSB0aGVuIGJlZ2luIGJsb2Njbzo9YmxvY2NvKzE7IHRvdGRvcm1pZW50aTo9dG90ZG9ybWllbnRpKzE7IGJyYW5jb1tibG9jY29dOj10b3Rkb3JtaWVudGk7IGk6PWkrMTsgdG90ZG9ybWllbnRpOj0wO2VuZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpOj1pKzE7IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKENbaV09Jy4nKSBhbmQgKENbaSsxXT0nLicpIHRoZW4gYmVnaW4gIGlmIGk9Ti0xIHRoZW4gYmVnaW4gYmxvY2NvOj1ibG9jY28rMTsgdG90ZG9ybWllbnRpOj10b3Rkb3JtaWVudGkrMjsgYnJhbmNvW2Jsb2Njb106PXRvdGRvcm1pZW50aTsgaTo9aSsxOyBlbmQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgYmVnaW4gaTo9aSsxOyB0b3Rkb3JtaWVudGk6PXRvdGRvcm1pZW50aSsxOyBlbmQgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQ1tpXT0nLicpIGFuZCAoQ1tpLTFdPSctJykgYW5kIChDW2krMV09Jy0nKSB0aGVuIGJlZ2luICBzaW5nb2xvOj1zaW5nb2xvKzE7IGJsb2Njbzo9YmxvY2NvKzE7dG90ZG9ybWllbnRpOj10b3Rkb3JtaWVudGkrMTsgYnJhbmNvW2Jsb2Njb106PXRvdGRvcm1pZW50aTsgIGk6PWkrMTsgdG90ZG9ybWllbnRpOj0wO2VuZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQ1tpXT0nLicpIGFuZCAoQ1tpKzFdPSctJykgdGhlbiBiZWdpbiAgIGJsb2Njbzo9YmxvY2NvKzE7dG90ZG9ybWllbnRpOj10b3Rkb3JtaWVudGkrMTticmFuY29bYmxvY2NvXTo9dG90ZG9ybWllbnRpOyAgaTo9aSsxOyB0b3Rkb3JtaWVudGk6PTA7IGVuZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBlbmQ7CiAgICAgICAgbWF4dGVtcG86PTA7CiAgICAgICAgZm9yIGk6PTEgdG8gYmxvY2NvIGRvIGJlZ2luIGNhbGNvbGF0ZW1wbyhicmFuY29baV0sdGVtcG9icmFuY29baV0pOyAgIGlmIHRlbXBvYnJhbmNvW2ldPm1heHRlbXBvIHRoZW4gbWF4dGVtcG86PSB0ZW1wb2JyYW5jb1tpXTsgZW5kOyAgICAgICAKICAgICAgICBXOj1ibG9jY287IAogICAgICAgIGlmIGJsb2Njbz0xIHRoZW4gUzo9dGVtcG9icmFuY29bMV0KICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIG1heHRlbXBvPmJsb2NjbyB0aGVuIFM6PW1heHRlbXBvCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBiZWdpbiBpZiBzaW5nb2xvPTAgdGhlbiBTOj1ibG9jY28rMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgUzo9YmxvY2NvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kOyAgICAgICAgICAgICAgICAgICAKICAgICAgICBXcml0ZUxuKFcsICcgJywgUyk7CiAgICBlbmQ7CmVuZC4=