#include <bits/stdc++.h>
using namespace std;
int main() {
  string s = "";
  string t;
  int l = 0;
  while (getline(cin, t) && l < 10) {
    s += t;
    l++;
  }
  int cur = -1;
  int mx = -1;
  int res[10000];
  memset(res, 0, sizeof(res));
  vector<int> vec;
  while (s.size()) {
    if (s.find("<table>") == 0) {
      cur++;
      mx = max(mx, cur);
      s = s.substr(7);
    } else if (s.find("<td>") == 0) {
      res[cur]++;
      s = s.substr(4);
    } else if (s.find("</table>") == 0) {
      vec.push_back(res[cur]);
      res[cur] = 0;
      cur--;
      s = s.substr(8);
    } else {
      s = s.substr(1);
    }
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < vec.size(); i++) {
    cout << vec[i];
    cout << " ";
  }
}
