#include <bits/stdc++.h>
using namespace std;
int i = 0;
int c = 0;
vector<string> tokens;
vector<int> counter;
void table();
void cell(int &);
void rows(int &);
string get_next();
string get_next() { return tokens[i]; }
void cell(int &x) {
  while (i < tokens.size() && get_next() == "<td>") {
    x++;
    i++;
    if (get_next() == "<table>") table();
    i++;
  }
  return;
}
void rows(int &x) {
  while (get_next() == "<tr>") {
    i++;
    cell(x);
    i++;
  }
  return;
}
void table() {
  while (i < tokens.size() && get_next() == "<table>") {
    i++;
    int x = 0;
    rows(x);
    counter.push_back(x);
    i++;
  }
  return;
}
int main() {
  string str, temp;
  while (getline(cin, temp)) {
    str += temp;
  }
  bool flag = 1;
  temp = "";
  int L = str.size();
  for (int a = 0; a < L; a++) {
    if (str[a] != '>')
      temp += str[a];
    else {
      temp += '>';
      tokens.push_back(temp);
      temp = "";
    }
  }
  table();
  sort(counter.begin(), counter.end());
  for (int a = 0; a < counter.size(); a++) {
    if (a != 0) cout << " ";
    cout << counter[a];
  }
  cout << endl;
  return 0;
}
