#include <bits/stdc++.h>
using namespace std;
int main() {
  string s = "", s2;
  vector<int> v;
  while (cin >> s2) {
    s += s2;
  }
  int tab[10000];
  fill(tab, tab + 10000, 0);
  int now = -1;
  for (int i = 0; i < s.size() - 5; i++) {
    if (s[i] == '<' && s[i + 2] == 'a') {
      now++;
    } else if (s[i] == '/' && s[i + 2] == 'a') {
      now--;
      v.push_back(tab[now + 1]);
      tab[now + 1] = 0;
    } else if (s[i] == '<' && s[i + 2] == 'd') {
      tab[now]++;
    }
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << endl;
}
