#include <bits/stdc++.h>
using namespace std;
vector<int> nums;
string html;
int idx;
int table();
int row();
int cell();
int main() {
  string s;
  while (cin >> s) html += s;
  idx = 0;
  nums.push_back(table());
  sort(nums.begin(), nums.end());
  for (int i = 0; i < (int)(nums.size()); i++) printf("%d ", nums[i]);
  return 0;
}
int table() {
  idx += 7;
  int ret = row();
  idx += 8;
  return ret;
}
int row() {
  int ret = 0;
  while (html.substr(idx, 4) == "<tr>") {
    idx += 4;
    ret += cell();
    idx += 5;
  }
  return ret;
}
int cell() {
  int ret = 0;
  while (html.substr(idx, 4) == "<td>") {
    idx += 4;
    ret += 1;
    if (html.substr(idx, 7) == "<table>") nums.push_back(table());
    idx += 5;
  }
  return ret;
}
