#include <bits/stdc++.h>
using namespace std;
int N;
int V[1000010];
char S[1000010];
int St[1000010];
bool isok(char c) {
  if (c >= 'a' && c <= 'z') return true;
  if (c == '/' || c == '<' || c == '>') return true;
  return false;
}
int main() {
  char lastchar = ' ';
  N = 0;
  int Ntables = 0;
  int ctable = 0;
  while (!feof(stdin)) {
    fgets(S + 1, 1000, stdin);
    scanf("\n");
    int cpnt = 1;
    while (cpnt <= strlen(S + 1))
      if (isok(S[cpnt])) {
        if (S[cpnt] < 'a' || S[cpnt] > 'z') {
          lastchar = S[cpnt];
          ++cpnt;
        } else {
          if (S[cpnt + 1] == 'a') {
            if (lastchar == '/') {
              --ctable;
              lastchar = 'e';
              cpnt += 5;
            } else {
              ++Ntables;
              ++ctable;
              St[ctable] = Ntables;
              lastchar = 'e';
              cpnt += 5;
            }
          } else if (S[cpnt + 1] == 'd') {
            if (lastchar != '/') ++V[St[ctable]];
            lastchar = 'd';
            cpnt += 2;
          } else {
            lastchar = S[cpnt];
            ++cpnt;
          }
        }
      } else
        ++cpnt;
  }
  sort(V + 1, V + Ntables + 1);
  for (int i = 1; i < Ntables; ++i) printf("%d ", V[i]);
  printf("%d\n", V[Ntables]);
  return 0;
}
