#include<iostream>
#include<string>
using namespace std;
int main(void)
{
	int score = 0;
	int runner = 0;
	int out = 0;
	int inning = 1;
	int inning_limit;
	cin>>inning_limit;
	int inning_score[34] = {};
	bool rui_1 = false;
	bool rui_2 = false;
	bool rui_3 = false;
	string hit[100];
	int i = 0;
	
	while(cin>>hit[i]){
		if(hit[i] == "HIT"){
			if(rui_3==true){
				inning_score[inning]++;
				
			}else{
				runner++;
			}
			rui_3 = rui_2;
			rui_2 = rui_1;
			rui_1 = true;
			runner++;
		}else if(hit[i] == "HOMERUN"){
			inning_score[inning] += runner + 1;
			runner = 0;
			rui_1=false;
			rui_2=false;
			rui_3=false;
		}else if(hit[i] == "OUT"){
			out++;
			if(out== 3){
				inning++;
				runner = 0;
				out = 0;
				inning_score[inning + 1] = 0; 
				rui_1=false;
				rui_2=false;
				rui_3=false;
				score += inning_score[inning];
				if(inning > inning_limit){
					break;
				}
			}
		}
		i++;
	}

	for(int j = 1; j <= inning_limit;j++){
		cout<<inning_score[j]<<endl;
	}

	return 0;
}