#include <bits/stdc++.h>
using namespace std;
char t[500002];
stack<int> stak;
vector<int> vec;
string s = "";
int main() {
  while (gets(t)) {
    s += t;
  }
  strcpy(t, s.c_str());
  char *p = strtok(t, "<>");
  while (p != NULL) {
    if (strcmp(p, "table") == 0) {
      stak.push(0);
    } else if (strcmp(p, "tr") == 0) {
    } else if (strcmp(p, "td") == 0) {
      int ea = stak.top();
      stak.pop();
      ea++;
      stak.push(ea);
    } else if (strcmp(p, "/tr") == 0) {
    } else if (strcmp(p, "/td") == 0) {
    } else if (strcmp(p, "/table") == 0) {
      vec.push_back(stak.top());
      stak.pop();
    }
    p = strtok(NULL, "<>");
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < vec.size(); i++) {
    if (i) printf(" ");
    printf("%d", vec[i]);
  }
  printf("\n");
  return 0;
}
