#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[5001], k = 0;
  string s, in;
  stack<int> s1;
  while (getline(cin, s)) {
    in = in + s;
  }
  for (int i = 0; i < in.size(); i++) {
    char st[5001] = {'\0'};
    if (in[i] == '<') {
      i++;
      int j = 0;
      while (in[i] != '>') {
        st[j++] = in[i];
        i++;
      }
    }
    string st1 = "table", st2 = "tr", st3 = "td", st4 = "/table", st5 = "/tr",
           st6 = "/td";
    if (st1.compare(st) == 0) arr[k++] = 1;
    if (st2.compare(st) == 0) arr[k++] = 2;
    if (st3.compare(st) == 0) arr[k++] = 3;
    if (st4.compare(st) == 0) arr[k++] = 4;
    if (st5.compare(st) == 0) arr[k++] = 5;
    if (st6.compare(st) == 0) arr[k++] = 6;
  }
  int z = -1, max = z;
  vector<int> v, v1;
  for (int i = 0; i < k; i++) {
    if (arr[i] == 1) {
      s1.push(arr[i]);
      v.push_back(0);
    }
    if (arr[i] == 2) s1.push(arr[i]);
    if (arr[i] == 3) s1.push(arr[i]);
    if (arr[i] == 4) {
      s1.pop();
      v1.push_back(v.back());
      v.pop_back();
    }
    if (arr[i] == 5) s1.pop();
    if (arr[i] == 6) {
      s1.pop();
      v.back()++;
    }
  }
  sort(v1.begin(), v1.end());
  for (int i = 0; i < v1.size(); i++) cout << v1[i] << " ";
  cout << endl;
  return 0;
}
