#include <bits/stdc++.h>
using namespace std;
vector<int> tablecount;
vector<string> v;
int recurse(int i) {
  int cnt = 0, k;
  for (k = i + 1; v[k] != "/table";) {
    if (v[k] == "tr") {
      k++;
      while (v[k] != "/tr") {
        while (v[k] == "td") {
          k++;
          if (v[k] == "table") k = recurse(k);
          if (v[k] == "/td") cnt++;
          k++;
        }
      }
      k++;
    }
  }
  tablecount.push_back(cnt);
  return k + 1;
}
int main() {
  string line;
  string s;
  while (cin >> line) s += line;
  for (int i = 0; i < s.size(); i++)
    if (s[i] == '>' || s[i] == '<') s[i] = ' ';
  stringstream ss(s);
  string wrd;
  while (ss >> wrd) v.push_back(wrd);
  recurse(0);
  sort(tablecount.begin(), tablecount.end());
  for (int i = 0; i < tablecount.size() - 1; i++) cout << tablecount[i] << " ";
  cout << tablecount.back() << "\n";
}
