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]='-') and (i<>N-1) then i:=i+1
else
if (C[i]='-') and (i=N-1) and (C[i+1]='.') then begin singolo:=singolo+1;blocco:=blocco+1; totdormienti:=totdormienti+1; branco[blocco]:=totdormienti; i:=i+1; end
else
if (C[i]='-') and (i=N-1) and (C[i+1]='-') 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 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.
UHJvZ3JhbSB3YWxydXM7CnZhcgogICAgTiwgUywgVCwgVywgdGVzdCxpLCBzaW5nb2xvLCBibG9jY28sIHRvdGRvcm1pZW50aSwgbWF4dGVtcG86IExvbmdJbnQ7CiAgICBDICAgICAgICAgICAgICAgIDogQW5zaVN0cmluZzsKICAgIGJyYW5jbywgdGVtcG9icmFuY286YXJyYXlbMS4uMzAwMDAwXSBvZiBsb25naW50OwoKUHJvY2VkdXJlIGNhbGNvbGF0ZW1wbyhCOmxvbmdpbnQ7IHZhciB0ZW1wbzpsb25naW50KSAgOwpiZWdpbgogIGlmIEI9MSB0aGVuIHRlbXBvOj0xCiAgICAgICAgIGVsc2UgaWYgQj0yIHRoZW4gdGVtcG86PTIKICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgIGJlZ2luCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIEIgbW9kIDI8PjAgdGhlbiB0ZW1wbyA6PSAoQi0zKSBkaXYgMiArMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHRlbXBvOj0gIChCLTMpIGRpdiAyICszOwogICAgICAgICAgICAgICAgICAgICAgIGVuZDsgICAgICAgICAgICAgICAgCmVuZDsKICAgIAogICAgCmJlZ2luCiAgICAoKmFzc2lnbihpbnB1dCwgICdpbnB1dC50eHQnKTsgIHJlc2V0KGlucHV0KTsKICAgIGFzc2lnbihvdXRwdXQsICdvdXRwdXQudHh0Jyk7IHJld3JpdGUob3V0cHV0KTsqKQogICAgUmVhZExuKFQpOwogICAgZm9yIHRlc3Q6PTEgdG8gVCBkbyBiZWdpbgogICAgICAgIFJlYWRMbihOKTsKICAgICAgICBSZWFkTG4oQyk7CiAgICAgICAgVyA6PSAwOwogICAgICAgIFMgOj0gMDsKICAgICAgICBzaW5nb2xvOj0wOwogICAgICAgIGJsb2Njbzo9MDsKICAgICAgICB0b3Rkb3JtaWVudGk6PTA7CiAgICAgICAgaTo9MTsgCiAgICAgICAgd2hpbGUgaTxOIGRvIAogICAgICAgICAgICAgICAgICAgIGJlZ2luCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDW2ldPSctJykgYW5kIChpPD5OLTEpICB0aGVuICBpOj1pKzEgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKENbaV09Jy0nKSBhbmQgKGk9Ti0xKSBhbmQgKENbaSsxXT0nLicpIHRoZW4gYmVnaW4gc2luZ29sbzo9c2luZ29sbysxO2Jsb2Njbzo9YmxvY2NvKzE7IHRvdGRvcm1pZW50aTo9dG90ZG9ybWllbnRpKzE7IGJyYW5jb1tibG9jY29dOj10b3Rkb3JtaWVudGk7IGk6PWkrMTsgZW5kCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDW2ldPSctJykgYW5kIChpPU4tMSkgYW5kIChDW2krMV09Jy0nKSB0aGVuIGk6PWkrMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDW2ldPScuJykgYW5kIChDW2krMV09Jy4nKSB0aGVuIGJlZ2luICBpZiBpPU4tMSB0aGVuIGJlZ2luIGJsb2Njbzo9YmxvY2NvKzE7IHRvdGRvcm1pZW50aTo9dG90ZG9ybWllbnRpKzI7IGJyYW5jb1tibG9jY29dOj10b3Rkb3JtaWVudGk7IGk6PWkrMTsgZW5kCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGJlZ2luIGk6PWkrMTsgdG90ZG9ybWllbnRpOj10b3Rkb3JtaWVudGkrMTsgZW5kIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKENbaV09Jy4nKSBhbmQgKENbaS0xXT0nLScpIGFuZCAoQ1tpKzFdPSctJykgIHRoZW4gYmVnaW4gIHNpbmdvbG86PXNpbmdvbG8rMTsgYmxvY2NvOj1ibG9jY28rMTt0b3Rkb3JtaWVudGk6PXRvdGRvcm1pZW50aSsxOyBicmFuY29bYmxvY2NvXTo9dG90ZG9ybWllbnRpOyAgaTo9aSsxOyB0b3Rkb3JtaWVudGk6PTA7ZW5kCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDW2ldPScuJykgYW5kIChDW2krMV09Jy0nKSB0aGVuIGJlZ2luICBibG9jY286PWJsb2NjbysxO3RvdGRvcm1pZW50aTo9dG90ZG9ybWllbnRpKzE7YnJhbmNvW2Jsb2Njb106PXRvdGRvcm1pZW50aTsgIGk6PWkrMTsgdG90ZG9ybWllbnRpOj0wOyBlbmQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBlbmQ7CiAgICAgICAgbWF4dGVtcG86PTA7IAogICAgICAgIGZvciBpOj0xIHRvIGJsb2NjbyBkbyBiZWdpbiBjYWxjb2xhdGVtcG8oYnJhbmNvW2ldLHRlbXBvYnJhbmNvW2ldKTsgICBpZiB0ZW1wb2JyYW5jb1tpXT5tYXh0ZW1wbyB0aGVuIG1heHRlbXBvOj0gdGVtcG9icmFuY29baV07IGVuZDsgICAgICAgCiAgICAgICAgVzo9YmxvY2NvOyAKICAgICAgICBpZiBibG9jY289MSB0aGVuIFM6PXRlbXBvYnJhbmNvWzFdCiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiBtYXh0ZW1wbz5ibG9jY28gdGhlbiBTOj1tYXh0ZW1wbwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgYmVnaW4gaWYgc2luZ29sbz0wIHRoZW4gUzo9YmxvY2NvKzEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIFM6PWJsb2NjbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZDsgICAgICAgICAgICAgICAgICAgCiAgICAgICAgV3JpdGVMbihXLCAnICcsIFMpOwogICAgZW5kOwplbmQu