#include <bits/stdc++.h>
using namespace std;
string s, dum;
int idx = 0;
int A[5000];
stack<int> S;
int main() {
  while (cin >> dum) {
    s += dum;
  }
  for (int i = 0; i < s.length(); i++) {
    dum = "";
    while (s[i] != '>') {
      dum += s[i];
      i++;
    }
    dum += ">";
    if (dum == "<table>") {
      S.push(idx);
      idx++;
    } else if (dum == "</table>") {
      S.pop();
    } else if (dum == "<td>") {
      A[S.top()]++;
    }
  }
  sort(A, A + idx);
  for (int i = 0; i < idx; i++) {
    if (i > 0) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  return 0;
}
