#include <bits/stdc++.h>
using namespace std;
string s;
int i = 0;
vector<int> res;
int getTable();
int getCell() {
  if (s[i + 2] != 'd') return -1;
  i += 4;
  getTable();
  i += 5;
  return 1;
}
int getRow() {
  if (s[i + 2] != 'r') return -1;
  i += 4;
  int curr = 0;
  while (true) {
    int tmp = getCell();
    if (tmp == -1) break;
    curr += tmp;
  }
  i += 5;
  return curr;
}
int getTable() {
  if (s[i + 2] != 'a') return -1;
  i += 7;
  int curr = 0;
  while (true) {
    int tmp = getRow();
    if (tmp == -1) break;
    curr += tmp;
  }
  i += 8;
  res.push_back(curr);
  return curr;
}
int main() {
  s = "";
  while (true) {
    string ss;
    cin >> ss;
    if (ss.empty()) break;
    s += ss;
  }
  getTable();
  sort(res.begin(), res.end());
  for (int i = 0; i < res.size(); i++) cout << res[i] << " ";
  cout << endl;
}
