#include <bits/stdc++.h>
using namespace std;
const int mm = 27700;
char tt[][40] = {"table", "/table", "tr", "/tr", "td", "/td"};
char s[mm], t[mm];
long long table[mm], num, zk, zr, stak[mm], sta;
int main() {
  int pos = 0;
  while (cin >> s) {
    pos += sprintf(t + pos, "%s", s);
  }
  memset(table, 0, sizeof(table));
  memset(stak, 0, sizeof(stak));
  sta = -1;
  int i = 0, kos = 0;
  num = zk = zr = 0;
  for (i = 0; i < pos;) {
    if (t[i] == '<') {
      ++i;
      kos = 0;
      for (; i < pos; ++i)
        if (t[i] == '>') {
          s[kos] = '\0';
          ++i;
          break;
        } else {
          s[kos] = t[i];
          kos++;
        }
      for (int j = 0; j < 6; j++) {
        if (strcmp(s, tt[j]) == 0) {
          if (j == 1) {
            zk = stak[--sta];
          }
          if (j == 0) {
            stak[++sta] = num;
            zk = num;
            ++num;
          }
          if (j == 5) {
            ++table[zk];
          }
          break;
        }
      }
    }
  }
  sort(table, table + num);
  for (int j = 0; j < num; ++j) {
    cout << table[j] << " ";
  }
  return 0;
}
