#include <bits/stdc++.h>
using namespace std;
int a[100000];
char t[1000];
int main() {
  string s, sa;
  stack<int> sta;
  int i, j;
  while (cin >> sa) {
    s += sa;
  }
  int cnt = 0;
  for (i = 0; i < s.length(); i++) {
    if (s[i] != '<') continue;
    i++;
    for (j = 0; i < s.length() && s[i] != '>'; i++, j++) {
      t[j] = s[i];
    }
    t[j] = '\0';
    if (strcmp(t, "table") == 0) {
      sta.push(0);
    } else if (strcmp(t, "/table") == 0) {
      a[cnt++] = sta.top();
      sta.pop();
    } else if (strcmp(t, "/td") == 0) {
      sta.top()++;
    }
  }
  sort(a, a + cnt);
  for (i = 0; i < cnt - 1; i++) cout << a[i] << " ";
  cout << a[i] << endl;
  return 0;
}
