#include <bits/stdc++.h>
using namespace std;
int pos;
string s, cad;
vector<int> v;
void tabla();
int celda() {
  pos++;
  if (cad[pos] == 'T') {
    tabla();
    pos++;
  }
  return 1;
}
int fila() {
  int cont = 0;
  pos++;
  while (cad[pos] == 'C') {
    cont += celda();
    pos++;
  }
  return cont;
}
void tabla() {
  int cont = 0;
  pos++;
  while (cad[pos] == 'F') {
    cont += fila();
    pos++;
  }
  v.push_back(cont);
}
int main() {
  while (cin >> cad) s += cad;
  string aux = "";
  cad = "";
  for (int i = 0; i < s.length(); ++i) {
    aux += s[i];
    if (aux == "<table>") {
      cad += "T";
      aux = "";
    }
    if (aux == "<tr>") {
      cad += "F";
      aux = "";
    }
    if (aux == "<td>") {
      cad += "C";
      aux = "";
    }
    if (aux == "</td>") {
      cad += "c";
      aux = "";
    }
    if (aux == "</tr>") {
      cad += "f";
      aux = "";
    }
    if (aux == "</table>") {
      cad += "t";
      aux = "";
    }
  }
  tabla();
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); ++i) {
    if (i != 0) printf(" ");
    printf("%d", v[i]);
  }
  puts("");
}
