#include <bits/stdc++.h>
using namespace std;
int cur = 0;
string nextTok(string& s) {
  string res = "";
  while (s[cur] != '<') cur++;
  cur++;
  while (s[cur] != '>') res += s[cur++];
  return res;
}
int main() {
  string s, s1;
  cin >> s;
  while (!cin.eof()) {
    cin >> s1;
    s = s + s1;
  }
  vector<int> ans;
  stack<int> rp;
  int j = -1;
  do {
    string tok = nextTok(s);
    if (tok == "td")
      ans[j]++;
    else if (tok == "table") {
      ans.push_back(0);
      rp.push(j);
      j = ans.size() - 1;
    } else if (tok == "/table") {
      j = rp.top();
      rp.pop();
    }
  } while (j != -1);
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << ' ';
  return 0;
}
