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