program walrus;
var
N, S, T, W, test,i,h, singolo, blocco, totdormienti: LongInt;
C : AnsiString;
branco, tempobranco: array[1..300000] of longint;
Procedure calcolatempo (B:longint; var tempo:longint) ;
begin
if B mod 2 <>0 then tempo := (B-3) div 2 +2
else tempo:= (B-3) div 2 +3;
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
h:=0;
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 blocco:=blocco+1;totdormienti:=totdormienti+1; branco[blocco]:=totdormienti; i:=i+1; totdormienti:=0; end;
end;
for i:=1 to blocco do write(branco[i],' ') ; writeln;
for i:=1 to blocco do calcolatempo(branco[i], tempobranco[i]);
for i:=1 to blocco do write(tempobranco[i],' ') ; writeln;
W:=blocco;
if singolo=0 then S:=W+1
else S:=W;
WriteLn(W, ' ', S);
end;
end.
cHJvZ3JhbSB3YWxydXM7CnZhcgogICAgTiwgUywgVCwgVywgdGVzdCxpLGgsIHNpbmdvbG8sIGJsb2NjbywgdG90ZG9ybWllbnRpOiBMb25nSW50OwogICAgQyAgICAgICAgICAgICAgICA6IEFuc2lTdHJpbmc7CiAgICBicmFuY28sIHRlbXBvYnJhbmNvOiBhcnJheVsxLi4zMDAwMDBdIG9mIGxvbmdpbnQ7CiAgICAKUHJvY2VkdXJlIGNhbGNvbGF0ZW1wbyAoQjpsb25naW50OyB2YXIgdGVtcG86bG9uZ2ludCkgOwpiZWdpbgogIGlmIEIgbW9kIDIgPD4wIHRoZW4gdGVtcG8gOj0gKEItMykgZGl2IDIgKzIKICAgICAgICAgICAgICAgICBlbHNlIHRlbXBvOj0gIChCLTMpIGRpdiAyICszOwplbmQ7ICAgICAgICAgICAgICAgICAKCmJlZ2luCiAgICAoKmFzc2lnbihpbnB1dCwgICdpbnB1dC50eHQnKTsgIHJlc2V0KGlucHV0KTsKICAgIGFzc2lnbihvdXRwdXQsICdvdXRwdXQudHh0Jyk7IHJld3JpdGUob3V0cHV0KTsqKQogICAgUmVhZExuKFQpOwogICAgZm9yIHRlc3Q6PTEgdG8gVCBkbyBiZWdpbgogICAgICAgIFJlYWRMbihOKTsKICAgICAgICBSZWFkTG4oQyk7CiAgICAgICAgVyA6PSAwOwogICAgICAgIFMgOj0gMDsKICAgICAgICBzaW5nb2xvOj0wOwogICAgICAgIGJsb2Njbzo9MDsKICAgICAgICB0b3Rkb3JtaWVudGk6PTA7CiAgICAgICAgaTo9MTsgCiAgICAgICAgd2hpbGUgaTxOIGRvIAogICAgICAgICAgICAgICAgICAgIGJlZ2luCiAgICAgICAgICAgICAgICAgICAgICAgIGg6PTA7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIENbaV09Jy0nICB0aGVuIGk6PWkrMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKENbaV09Jy4nKSBhbmQgKENbaSsxXT0nLicpIHRoZW4gYmVnaW4gIGlmIGk9Ti0xIHRoZW4gYmVnaW4gICBibG9jY286PWJsb2NjbysxOyB0b3Rkb3JtaWVudGk6PXRvdGRvcm1pZW50aSsyO2JyYW5jb1tibG9jY29dOj10b3Rkb3JtaWVudGk7ICBpOj1pKzE7ICBlbmQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgYmVnaW4gICBpOj1pKzE7IHRvdGRvcm1pZW50aTo9dG90ZG9ybWllbnRpKzE7IGVuZCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDW2ldPScuJykgYW5kIChDW2ktMV09Jy0nKSBhbmQgKENbaSsxXT0nLScpIHRoZW4gYmVnaW4gIHNpbmdvbG86PXNpbmdvbG8rMTsgYmxvY2NvOj1ibG9jY28rMTsgdG90ZG9ybWllbnRpOj10b3Rkb3JtaWVudGkrMTticmFuY29bYmxvY2NvXTo9dG90ZG9ybWllbnRpOyBpOj1pKzE7IHRvdGRvcm1pZW50aTo9MDsgZW5kCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDW2ldPScuJykgYW5kIChDW2krMV09Jy0nKSB0aGVuIGJlZ2luICAgYmxvY2NvOj1ibG9jY28rMTt0b3Rkb3JtaWVudGk6PXRvdGRvcm1pZW50aSsxOyBicmFuY29bYmxvY2NvXTo9dG90ZG9ybWllbnRpOyBpOj1pKzE7IHRvdGRvcm1pZW50aTo9MDsgZW5kOwogICAgICAgICAgICAgICAgICAgIGVuZDsKICAgIGZvciBpOj0xIHRvIGJsb2NjbyBkbyB3cml0ZShicmFuY29baV0sJyAnKSA7IHdyaXRlbG47CiAgICBmb3IgaTo9MSB0byBibG9jY28gZG8gY2FsY29sYXRlbXBvKGJyYW5jb1tpXSwgdGVtcG9icmFuY29baV0pOyAKICAgIGZvciBpOj0xIHRvIGJsb2NjbyBkbyB3cml0ZSh0ZW1wb2JyYW5jb1tpXSwnICcpIDsgIHdyaXRlbG47CiAgICBXOj1ibG9jY287CiAgICBpZiBzaW5nb2xvPTAgdGhlbiBTOj1XKzEKICAgICAgICAgICAgICAgICAgICAgZWxzZSBTOj1XOwogICAgV3JpdGVMbihXLCAnICcsIFMpOwogICAgZW5kOwplbmQuCgo=