#include <bits/stdc++.h>
using namespace std;
const int inf = 1999999999;
const double pi = 3.1415926535897932384626;
const double eps = 1E-11;
char gc() {
  char c;
  while (isspace(c = getchar()))
    ;
  return c;
}
string s = "";
vector<int> v;
pair<int, int> recurse(int a) {
  if (s[a + 1] == '/') return make_pair(a, 0);
  a++;
  string t = "";
  while (s[a] != '>') {
    t += s[a];
    a++;
  }
  a++;
  if (t == "table") {
    int s = 0;
    while (true) {
      pair<int, int> t = recurse(a);
      if (t.first == a) {
        v.push_back(s);
        return make_pair(a + 8, s);
      }
      a = t.first;
      s += t.second;
    }
  } else if (t == "tr") {
    int s = 0;
    while (true) {
      pair<int, int> t = recurse(a);
      if (t.first == a) return make_pair(a + 5, s);
      a = t.first;
      s += t.second;
    }
  } else if (t == "td") {
    pair<int, int> t = recurse(a);
    if (t.first == a) return make_pair(a + 5, 1);
    a = t.first;
    return make_pair(a + 5, 1);
  }
  return make_pair(-1, -1);
}
int main() {
  char c;
  while ((c = gc()) != EOF) s += c;
  recurse(0);
  sort((v).begin(), (v).end());
  for (int i = 0; i < ((int)(v).size()); i++) printf("%d ", v[i]);
}
