#include <bits/stdc++.h>
using namespace std;
int nRes;
int res[5000];
string S;
int carg[5000];
int buscaFin(int W);
int main() {
  string W;
  int i, j;
  int N;
  char tmp[5005];
  while (scanf("%s", tmp) != EOF) {
    W += tmp;
  }
  N = W.size();
  for (i = 0; i < N;) {
    if (W.substr(i, 4) == "<tr>") {
      S += '{';
      i += 4;
    } else if (W.substr(i, 4) == "<td>") {
      S += '<';
      i += 4;
    } else if (W.substr(i, 5) == "</tr>") {
      S += '}';
      i += 5;
    } else if (W.substr(i, 5) == "</td>") {
      S += '>';
      i += 5;
    } else if (W.substr(i, 7) == "<table>") {
      S += '[';
      i += 7;
    } else if (W.substr(i, 8) == "</table>") {
      S += ']';
      i += 8;
    } else {
      i++;
    }
  }
  N = S.size();
  i = 0;
  nRes = 0;
  while (i < N) {
    i = buscaFin(i);
    i++;
  }
  sort(res, res + nRes);
  for (i = 0; i < nRes; i++) {
    printf("%d ", res[i]);
  }
  printf("\n");
  return 0;
}
int buscaFin(int W) {
  int i, c = 0;
  i = W + 1;
  while (S[i] != S[W] + 2) {
    i = buscaFin(i);
    if (S[i] != ']') c += carg[i];
    i++;
  }
  carg[i] = c;
  if (S[W] == '<') carg[i]++;
  if (S[i] == ']') res[nRes++] = carg[i];
  return i;
}
