#include <bits/stdc++.h>
using namespace std;
void Dziel(string nap, vector<int>& r) {
  int n = nap.size();
  for (int l = 0; l < n;) {
    int p = l;
    while (p < n && nap[p] != '>') ++p;
    if (p == n) --p;
    string x = "";
    for (int i = l; i <= p; ++i) x += nap[i];
    if (x == "<table>") r.push_back(1);
    if (x == "</table>") r.push_back(-1);
    if (x == "</td>") r.push_back(-3);
    l = p + 1;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  string nap, p;
  while (cin >> p) nap += p;
  vector<int> r;
  Dziel(nap, r);
  vector<int> odp;
  stack<int> S;
  int akt;
  for (int i = 0; i < r.size(); ++i) {
    if (r[i] == 1) {
      akt = odp.size();
      odp.push_back(0);
      S.push(akt);
    }
    if (r[i] == -1) {
      S.pop();
      if (S.size() != 0) akt = S.top();
    }
    if (r[i] == -3) ++odp[akt];
  }
  sort(odp.begin(), odp.end());
  for (int i = 0; i < odp.size(); ++i) cout << odp[i] << " ";
  return 0;
}
