#include <bits/stdc++.h>
using namespace std;
vector<int> result;
string s;
int analyze(int start) {
  int end = start + 1;
  int size = 0;
  do {
    if (s.substr(end, 4) == "<td>") size++;
    if (s.substr(end, 7) == "<table>") {
      end = analyze(end);
    }
    if (s.substr(end, 8) == "</table>") {
      result.push_back(size);
      return end + 8;
    }
    if (end == s.length() - 1) return end;
  } while (end++);
}
int main() {
  string dlddu;
  while (cin >> dlddu) s += dlddu;
  analyze(0);
  sort(result.begin(), result.end());
  for (int i = 0; i < result.size(); i++) cout << result[i] << " ";
  cout << endl;
}
