#include <bits/stdc++.h>
using namespace std;
int main() {
  stack<int> st;
  char s[5000], d[5000];
  int i = 0, p = 15, x[170] = {0}, m = 1, a[1250] = {1, 2, 3}, t = 3;
  while (cin >> d) strcat(s, d);
  while (p < strlen(s)) {
    if (s[p + 2] == 'r') {
      p += 4;
    } else if (s[p + 2] == 'd') {
      a[t++] = 3;
      p += 4;
    } else if (s[p + 2] == 'a') {
      a[t++] = 1;
      p += 7;
    } else if (s[p + 3] == 'd') {
      p += 5;
    } else if (s[p + 3] == 'r') {
      p += 5;
    } else if (s[p + 3] == 'a') {
      a[t++] = 6;
      p += 8;
    }
  }
  st.push(1);
  p = 1;
  while (true) {
    if (a[p] == 3)
      x[i]++;
    else if (a[p] == 1) {
      st.push(++m);
      i = m - 1;
    } else if (a[p] == 6) {
      st.pop();
      if (st.empty())
        break;
      else
        i = st.top() - 1;
    }
    p++;
  }
  sort(x, x + m);
  for (i = 0; i < m; i++) cout << x[i] << " ";
}
