Program walrus;
var
N, S, T, W, test,i, singolo, blocco, totdormienti: 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;
if N=1 then begin W:=1; S:=1; end
else begin
i:=1;
while i<N do
begin
if C[i]='-' then i:=i+1
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 i:=i+1; blocco:=blocco+1;totdormienti:=totdormienti+1;branco[blocco]:=totdormienti; i:=i+1; totdormienti:=0; end;
end;
for i:=1 to blocco do calcolatempo(branco[i],tempobranco[i]);
W:=blocco;
if blocco=1 then S:=tempobranco[1]
else if singolo=0 then S:=blocco+1
else S:=blocco;
end;
WriteLn(W, ' ', S);
end;
end.
UHJvZ3JhbSB3YWxydXM7CnZhcgogICAgTiwgUywgVCwgVywgdGVzdCxpLCBzaW5nb2xvLCBibG9jY28sIHRvdGRvcm1pZW50aTogTG9uZ0ludDsKICAgIEMgICAgICAgICAgICAgICAgOiBBbnNpU3RyaW5nOwogICAgYnJhbmNvLCB0ZW1wb2JyYW5jbzphcnJheVsxLi4zMDAwMDBdIG9mIGxvbmdpbnQ7CgpQcm9jZWR1cmUgY2FsY29sYXRlbXBvKEI6bG9uZ2ludDsgdmFyIHRlbXBvOmxvbmdpbnQpICA7CmJlZ2luCiAgaWYgQj0xIHRoZW4gdGVtcG86PTEKICAgICAgICAgZWxzZSBpZiBCPTIgdGhlbiB0ZW1wbzo9MgogICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgYmVnaW4KICAgICAgICAgICAgICAgICAgICAgICAgaWYgQiBtb2QgMjw+MCB0aGVuIHRlbXBvIDo9IChCLTMpIGRpdiAyICsyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgdGVtcG86PSAgKEItMykgZGl2IDIgKzM7CiAgICAgICAgICAgICAgICAgICAgICAgZW5kOyAgICAgICAgICAgICAgICAKZW5kOwogICAgCiAgICAKYmVnaW4KICAgICgqYXNzaWduKGlucHV0LCAgJ2lucHV0LnR4dCcpOyAgcmVzZXQoaW5wdXQpOwogICAgYXNzaWduKG91dHB1dCwgJ291dHB1dC50eHQnKTsgcmV3cml0ZShvdXRwdXQpOyopCiAgICBSZWFkTG4oVCk7CiAgICBmb3IgdGVzdDo9MSB0byBUIGRvIGJlZ2luCiAgICAgICAgUmVhZExuKE4pOwogICAgICAgIFJlYWRMbihDKTsKICAgICAgICBXIDo9IDA7CiAgICAgICAgUyA6PSAwOwogICAgICAgIHNpbmdvbG86PTA7CiAgICAgICAgYmxvY2NvOj0wOwogICAgICAgIHRvdGRvcm1pZW50aTo9MDsKICAgICAgICBpZiBOPTEgdGhlbiBiZWdpbiAgVzo9MTsgUzo9MTsgZW5kCiAgICAgICAgICAgICAgIGVsc2UgYmVnaW4KICAgICAgICBpOj0xOyAKICAgICAgICB3aGlsZSBpPE4gZG8gCiAgICAgICAgICAgICAgICAgICAgYmVnaW4KICAgICAgICAgICAgICAgICAgICAgICAgaWYgQ1tpXT0nLScgIHRoZW4gaTo9aSsxICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQ1tpXT0nLicpIGFuZCAoQ1tpKzFdPScuJykgdGhlbiBiZWdpbiAgaWYgaT1OLTEgdGhlbiBiZWdpbiBibG9jY286PWJsb2NjbysxOyB0b3Rkb3JtaWVudGk6PXRvdGRvcm1pZW50aSsyOyBicmFuY29bYmxvY2NvXTo9dG90ZG9ybWllbnRpOyBpOj1pKzE7IGVuZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBiZWdpbiBpOj1pKzE7IHRvdGRvcm1pZW50aTo9dG90ZG9ybWllbnRpKzE7IGVuZCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDW2ldPScuJykgYW5kIChDW2ktMV09Jy0nKSBhbmQgKENbaSsxXT0nLScpIHRoZW4gYmVnaW4gIHNpbmdvbG86PXNpbmdvbG8rMTsgYmxvY2NvOj1ibG9jY28rMTt0b3Rkb3JtaWVudGk6PXRvdGRvcm1pZW50aSsxOyBicmFuY29bYmxvY2NvXTo9dG90ZG9ybWllbnRpOyAgaTo9aSsxOyB0b3Rkb3JtaWVudGk6PTA7ZW5kCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDW2ldPScuJykgYW5kIChDW2krMV09Jy0nKSB0aGVuIGJlZ2luICBpOj1pKzE7IGJsb2Njbzo9YmxvY2NvKzE7dG90ZG9ybWllbnRpOj10b3Rkb3JtaWVudGkrMTticmFuY29bYmxvY2NvXTo9dG90ZG9ybWllbnRpOyAgaTo9aSsxOyB0b3Rkb3JtaWVudGk6PTA7IGVuZDsKICAgICAgICAgICAgICAgICAgICBlbmQ7CiAgICAgICAgZm9yIGk6PTEgdG8gYmxvY2NvIGRvIGNhbGNvbGF0ZW1wbyhicmFuY29baV0sdGVtcG9icmFuY29baV0pOyAgICAgICAgICAgIAogICAgICAgIFc6PWJsb2NjbzsgCiAgICAgICAgaWYgYmxvY2NvPTEgdGhlbiBTOj10ZW1wb2JyYW5jb1sxXQogICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgc2luZ29sbz0wIHRoZW4gUzo9YmxvY2NvKzEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIFM6PWJsb2NjbzsgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kOwogICAgICAgIFdyaXRlTG4oVywgJyAnLCBTKTsKICAgIGVuZDsKZW5kLgoK