#include<iostream>
#include<sstream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<algorithm>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e12,EPS=1e-9;

int n,s[10],t;

int main()
{
	while(scanf("%d",&n),n)
	{
		rep(i,10)s[i]=0;
		rep(i,n)scanf("%d",&t),s[t]++;
		rep(i,10)
		{
			if(s[i]==0)putchar('-');
			rep(j,s[i]+1)putchar(j==s[i]?'\n':'*');
		}
	}
	return 0;
}
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	int n;
	cin>>n;
	REP(i, n) {
		int out = 0;
		int score = 0;
		vector<bool> rui(3, false);
		while(out < 3) {
			string hoge;
			cin>>hoge;
			if(hoge == "HIT") {
				if(rui[2]) {
					++score;
				}
				for(int j = 1; j >= 0; --j) {
					rui[j + 1] = rui[j];
				}
				rui[0] = true;
			} else if (hoge == "OUT") {
				++out;
			} else if(hoge == "HOMERUN") {
				score++;
				REP(j, 3) {
					if(rui[j]) ++score;
					rui[j] = false;
				}
			}
		}
		cout<<score<<endl;
	}
}