#include <bits/stdc++.h>
using namespace std;
int main() {
  stack<int> tabel;
  int ar[1000], cek, len, counter = 0, i;
  string st, dum;
  memset(ar, 0, sizeof(ar));
  st = "";
  while (getline(cin, dum)) {
    st += dum;
  }
  len = st.length();
  cek = 0;
  while (cek < len) {
    if (st[cek] == '<') {
      if ((st[cek + 1] == '/') && (st[cek + 3] == 'a'))
        tabel.pop();
      else if (st[cek + 1] != '/') {
        if (st[cek + 2] == 'd') {
          ++ar[tabel.top() - 1];
          cek += 3;
        }
        if (st[cek + 2] == 'a') {
          ++counter;
          cek += 6;
          tabel.push(counter);
        }
      }
    }
    ++cek;
  }
  sort(ar, ar + counter);
  --counter;
  for (i = 0; i < counter; ++i) printf("%d ", ar[i]);
  printf("%d\n", ar[counter]);
  scanf("%d", &i);
  return 0;
}
