#include <bits/stdc++.h>
using namespace std;
string s;
vector<int> ans;
int ind = 0;
void go(int table) {
  if (s[ind + 2] == 'a') {
    ans.push_back(0);
    ind += 7;
    go(ans.size() - 1);
    ind += 8;
    return;
  }
  if (s[ind + 2] == 'r') {
    ind += 4;
    go(table);
    ind += 5;
    go(table);
    return;
  }
  if (s[ind + 2] == 'd') {
    ans[table]++;
    ind += 4;
    go(table);
    ind += 5;
    go(table);
    return;
  }
  if (s[ind + 2] == 't') {
    return;
  }
}
int main(void) {
  string ss;
  while (cin >> ss) {
    s += ss;
  }
  go(0);
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  return 0;
}
