#include <bits/stdc++.h>
using namespace std;
int n;
string s, temp;
vector<int> f;
vector<int> v;
int idx = 0;
int p[100005], pd[100005];
vector<int> dfs(int l, int r) {
  int res = 0;
  vector<vector<int> > ret;
  for (int i = l + 1; i < r; i++) {
    if (f[i] == 0) {
      vector<int> t = dfs(i, p[i]);
      ret.push_back(t);
      i = p[i];
    } else if (f[i] == 2) {
      res++;
    }
  }
  vector<int> s;
  for (int i = ret.size() - 1; i >= 0; i--) {
    for (int j = 0; j < ret[i].size(); j++) s.push_back(ret[i][j]);
  }
  s.push_back(res);
  return s;
}
int main() {
  s = "";
  while (cin >> temp) s += temp;
  n = s.size();
  string temp = "";
  for (int i = 0; i < n; i++) {
    if (s[i] == '>') {
      temp += s[i];
      if (temp == "<table>") f.push_back(0);
      if (temp == "</table>") f.push_back(1);
      if (temp == "<td>") f.push_back(2);
      if (temp == "</td>") f.push_back(3);
      temp = "";
    } else {
      temp += s[i];
    }
  }
  vector<int> s;
  vector<int> td;
  idx = 0;
  for (int i = 0; i < f.size(); i++) {
    if (f[i] == 0) {
      s.push_back(i);
    } else if (f[i] == 1) {
      p[s.back()] = i;
      s.pop_back();
    } else if (f[i] == 2) {
      td.push_back(i);
    } else if (f[i] == 3) {
      pd[td.back()] = i;
      td.pop_back();
    }
  }
  if (!td.empty() || !s.empty() || p[0] != f.size() - 1)
    while (1)
      ;
  v = dfs(0, p[0]);
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    printf("%d", v[i]);
    if (i < v.size() - 1) printf(" ");
  }
  puts("");
  return 0;
}
