- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
#include<iostream>
using namespace std;
#include<string.h>
int main()
{
int n;
int t;
char s[100];
cin>>n;
while(n!=0)
{
n--;
int TTT=0,TTH=0,THT=0,THH=0,HTT=0,HTH=0,HHT=0,HHH=0,H=0,T=0;
cin>>t;
cin>>s;
cout<<s<<"\n";
int f=0;
for(int i=0;i<strlen(s);i++)
{
if(s[i]=='T' && s[i+1]=='T' && s[i+2]=='T')
TTT+=1;
if(s[i]=='T' && s[i+1]=='T' && s[i+2]=='H')
TTH+=1;
if(s[i]=='T' && s[i+1]=='H' && s[i+2]=='T')
THT+=1;
if(s[i]=='T' && s[i+1]=='H' && s[i+2]=='H')
THH+=1;
if(s[i]=='H' && s[i+1]=='T' && s[i+2]=='T')
HTT+=1;
if(s[i]=='H' && s[i+1]=='T' && s[i+2]=='H')
HTH+=1;
if(s[i]=='H' && s[i+1]=='H' && s[i+2]=='T')
HHT+=1;
if(s[i]=='H' && s[i+1]=='H' && s[i+2]=='H')
TTT+=1;
if(s[i]=='H'){
H++;f=1;}
if(s[i]=='T'){
T++;f=1;}
}
cout<<TTT<<"\n";
if(H==40)
cout<<t<<" 0 0 0 0 0 0 0 38\n";
if(T==40)
cout<<t<<" 38 0 0 0 0 0 0 0\n";
if(f==0)
cout<<t<<" "<<TTT<<" "<<TTH<<" "<<THT<<" "<<THH<<" "<<HTT<<" "<<HTH<<" "<<HHT<<" "<<HHH<<"\n";
}
return 0;
}