#include <bits/stdc++.h>
using namespace std;
double const pi = 3.1415926535897932384626433832795;
int const inf = (int)1e9;
long long const inf64 = (long long)2e18;
vector<int> ans;
int table();
string get_word() {
  int now = 0;
  char ch = ' ', s[10];
  while (ch <= ' ') scanf("%c", &ch);
  while (ch != '>') {
    s[now++] = ch;
    ch = ' ';
    while (ch <= ' ') scanf("%c", &ch);
  }
  s[now++] = ch;
  s[now] = '\0';
  string res;
  res = s;
  return res;
}
int cell() {
  int res = 0;
  string now = get_word();
  while (now != "</td>") {
    if (now == "<table>") {
      int tmp = table();
      ans.push_back(tmp);
      res++;
    }
    now = get_word();
  }
  if (!res) res = 1;
  return res;
}
int row() {
  int res = 0;
  string now = get_word();
  while (now != "</tr>") {
    if (now == "<td>") res += cell();
    now = get_word();
  }
  return res;
}
int table() {
  int res = 0;
  string now = get_word();
  while (now != "</table>") {
    if (now == "<tr>") res += row();
    now = get_word();
  }
  return res;
}
int main() {
  ans.push_back(table());
  sort((ans).begin(), (ans).end());
  for (int i = 0; i < (int)ans.size(); i++) printf("%d ", ans[i]);
  return 0;
}
