#include <bits/stdc++.h>
using namespace std;
char s[12000];
int n, i, j;
vector<int> ans;
int cek(int v, int t, string e) {
  if (v >= strlen(s) - 1) return v;
  int i = v;
  do {
    string tmp = "";
    for (i = i;; i++) {
      tmp.push_back(s[i]);
      if (s[i] == '>') break;
    }
    i++;
    if (e == "<table>" && tmp == "</table>") break;
    if (e == "<tr>" && tmp == "</tr>") break;
    if (e == "<td>" && tmp == "</td>") {
      ans[t]++;
      break;
    }
    if (tmp == "<table>") {
      ans.push_back(0);
      i = cek(i, ans.size() - 1, tmp);
    } else if (tmp == "<tr>") {
      i = cek(i, t, tmp);
    } else if (tmp == "<td>") {
      i = cek(i, t, tmp);
    }
  } while (i < strlen(s));
  return i;
}
int main() {
  n = 0;
  bool f = 1;
  while (scanf("%c", &s[n]) != EOF) {
    if (s[n] != '\n') n++;
  }
  int k = cek(0, -1, " ");
  sort(ans.begin(), ans.end());
  for (i = 0; i < ans.size(); i++) {
    if (f)
      f = 0;
    else
      printf(" ");
    cout << ans[i];
  }
  cout << endl;
  return 0;
}
