#include <bits/stdc++.h>
using namespace std;
int main() {
  string text, s = "";
  while (cin >> text) s += text;
  vector<int> v;
  string token = "";
  int indx = 0, prev = 0;
  vector<int> prevs;
  for (int i = 0; i < s.length(); ++i) {
    token += s[i];
    if (s[i] == '>') {
      if (token == "<table>") {
        v.push_back(0);
        prevs.push_back(indx);
        indx = v.size() - 1;
      } else if (token == "</table>") {
        indx = prevs[prevs.size() - 1];
        prevs.erase(prevs.end() - 1, prevs.end());
      } else if (token == "<td>") {
        v[indx]++;
      }
      token = "";
    }
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); ++i) cout << v[i] << " ";
  return 0;
}
