#include <bits/stdc++.h>
using namespace std;
int N, pos;
string s;
vector<int> res;
int parse_rows();
int parse_cells();
void parse_table() {
  if (pos + 7 >= N) return;
  if (s.substr(pos, 7) != "<table>") return;
  pos += 7;
  int cell = parse_rows();
  pos += 8;
  res.push_back(cell);
}
int parse_rows() {
  int cell = 0;
  for (;;) {
    if (pos + 4 >= N) assert(0);
    if (s.substr(pos, 4) == "<tr>") {
      pos += 4;
      cell += parse_cells();
      pos += 5;
    } else
      break;
  }
  return cell;
}
int parse_cells() {
  int cell = 0;
  for (;;) {
    if (pos + 4 >= N) assert(0);
    if (s.substr(pos, 4) == "<td>") {
      pos += 4;
      cell++;
      parse_table();
      assert(s.substr(pos, 5) == "</td>");
      pos += 5;
    } else
      break;
  }
  return cell;
}
int main() {
  string t;
  while (getline(cin, t)) s += t;
  res.clear();
  pos = 0;
  N = (int)((s).size());
  parse_table();
  sort(res.begin(), res.end());
  for (int j = 0; j < (int)((int)((res).size())); ++j) {
    if (j) printf(" ");
    printf("%d", res[j]);
  }
  puts("");
}
