#include <bits/stdc++.h>
using namespace std;
int main() {
  string s = "", s2;
  while (cin >> s2) {
    s += s2;
  }
  stack<int> k;
  size_t p = s.find_first_of('>');
  vector<int> td(10000, 0);
  int cur, ind = -1;
  while (p != string::npos) {
    s2 = s.substr(0, p + 1);
    s.erase(0, p + 1);
    if (s2 == "<table>") {
      k.push(cur);
      ind++;
      cur = ind;
    }
    if (s2 == "<td>") {
      td[cur]++;
    }
    if (s2 == "</table>") {
      cur = k.top();
      k.pop();
    }
    p = s.find_first_of('>');
  }
  td.resize(ind + 1);
  sort(td.begin(), td.end());
  for (size_t i = 0; i < td.size(); i++) {
    cout << td[i] << ' ';
  }
  return 0;
}
