#include <bits/stdc++.h>
using namespace std;
vector<int> res;
stack<int> st;
int main() {
  int tC = 0;
  string s, temp;
  while (cin >> temp) s += temp;
  res.push_back(0);
  for (int i = 0; i + 3 < s.length();) {
    if (s[i + 2] == 'a') {
      i += 7;
      ++tC;
      st.push(tC);
      res.push_back(0);
    } else if (s[i + 2] == 'r') {
      i += 4;
    } else if (s[i + 2] == 'd') {
      i += 4;
      res[st.top()]++;
    } else if (s[i + 3] == 'a') {
      i += 8;
      st.pop();
    } else if (s[i + 3] == 'r') {
      i += 5;
    } else if (s[i + 3] == 'd') {
      i += 5;
    }
  }
  sort(res.begin() + 1, res.end());
  for (int i = 1; i <= tC; i++) {
    cout << res[i] << " ";
  }
  return 0;
}
