#include <bits/stdc++.h>
using namespace std;
const int N = 10005;
char s[N];
int cnt[N], top;
int main() {
  int i, j, k;
  int len = 0;
  while (1) {
    if (scanf("%s", s + len) == EOF) break;
    len += strlen(s + len);
  }
  vector<int> ans;
  for (i = 0; i < len; i++) {
    if (s[i] == '<' && s[i + 2] == 'a') {
      cnt[top++] = 0;
      i += 6;
    }
    if (s[i] == '<' && s[i + 2] == 'd') {
      cnt[top - 1]++;
      i += 3;
    }
    if (s[i] == '<' && s[i + 1] == '/' && s[i + 3] == 'a') {
      ans.push_back(cnt[top - 1]);
      top--;
      i += 7;
    }
  }
  sort(ans.begin(), ans.end());
  for (vector<int>::iterator it = ans.begin(); it != ans.end(); it++) {
    cout << *it << ' ';
  }
  cout << endl;
  return 0;
}
