#include <bits/stdc++.h>
int id(std::string tag) {
  if (tag[0] == '/') {
    if (tag[2] == 'd') {
      return -1;
    }
    if (tag[2] == 'r') {
      return -2;
    }
    return -3;
  }
  if (tag[1] == 'd') {
    return 1;
  }
  if (tag[1] == 'r') {
    return 2;
  }
  return 3;
}
int main() {
  std::vector<int> tags;
  char ch;
  std::string cur;
  while (std::cin >> ch) {
    cur = "";
    std::cin >> ch;
    while (ch != '>') {
      cur += ch;
      std::cin >> ch;
    }
    tags.push_back(id(cur));
  }
  std::vector<int> levels(10000);
  int cur_level = -1;
  std::vector<int> cells;
  for (size_t i = 0; i < tags.size(); ++i) {
    if (tags[i] == 3) {
      cur_level++;
      levels[cur_level] = 0;
    } else if (tags[i] == 1 && cur_level >= 0) {
      levels[cur_level]++;
    } else if (tags[i] == -3) {
      cells.push_back(levels[cur_level]);
      cur_level--;
    }
  }
  std::sort(cells.begin(), cells.end());
  for (size_t i = 0; i < cells.size(); ++i) {
    std::cout << cells[i] << " ";
  }
  return 0;
}
