#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> ty, cl, q;
vector<int> ret;
void dfs(int cur);
void dfs(int cur, int ind) {
  for (int i = cur + 1; i < cl[cur]; i = cl[i] + 1) {
    ret[ind]++;
    if (cl[i] > i + 1) dfs(i + 1);
  }
}
void dfs(int cur) {
  int ind = ret.size();
  ret.push_back(0);
  for (int i = cur + 1; i < cl[cur]; i = cl[i] + 1) dfs(i, ind);
}
int main() {
  string s1, s2 = "";
  while (getline(cin, s1)) s2 += s1;
  for (int i = 0; i < (int)s2.size(); i++)
    if (s2[i] == '<' || s2[i] == '>') s2[i] = ' ';
  stringstream ss(s2);
  for (; ss >> s1; n++) {
    cl.push_back(n);
    if (s1 == "table")
      q.push_back(n);
    else if (s1 == "/table") {
      cl[q.back()] = n;
      q.pop_back();
    } else if (s1 == "tr")
      q.push_back(n);
    else if (s1 == "/tr") {
      cl[q.back()] = n;
      q.pop_back();
    } else if (s1 == "td")
      q.push_back(n);
    else if (s1 == "/td") {
      cl[q.back()] = n;
      q.pop_back();
    }
  }
  dfs(0);
  sort(ret.begin(), ret.end());
  for (int i = 0; i < (int)ret.size(); i++) {
    if (i) cout << " ";
    cout << ret[i];
  }
  cout << endl;
  return 0;
}
