#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[5001];
  string str;
  while (scanf("%s", s) != EOF) {
    str = str + s;
  }
  stack<int> x;
  vector<int> r;
  char s2[10000];
  char *s3;
  strcpy(s2, str.c_str());
  s3 = strtok(s2, "<>");
  if (s3 == NULL) return 0;
  string k = s3;
  while (1) {
    if (k == "") break;
    if (k == "table")
      x.push(0);
    else if (k == "td") {
      int l = x.top();
      l++;
      x.pop();
      x.push(l);
    } else if (k == "/table") {
      r.push_back(x.top());
      x.pop();
    }
    s3 = strtok(NULL, "<>");
    if (s3 == NULL) break;
    k = s3;
  }
  sort(r.begin(), r.end());
  int i;
  for (i = 0; i < r.size(); i++) {
    printf("%d ", r[i]);
  }
  cout << endl;
  return 0;
}
