#include <bits/stdc++.h>
using namespace std;
const string table = "table";
const string td = "td";
void solve(const string& s) {
  int n = s.size();
  int i = 0;
  vector<int> ans;
  stack<int> table_stack;
  while (i < n) {
    assert(s[i] == '<');
    if (s[i + 1] == '/') {
      if (i + 2 + (int)table.size() <= n &&
          s.substr(i + 2, table.size()) == table) {
        ans.push_back(table_stack.top());
        table_stack.pop();
        i += 3 + table.size();
      } else {
        while (s[i] != '>') i++;
        i++;
      }
    } else {
      if (i + 1 + (int)table.size() <= n &&
          s.substr(i + 1, table.size()) == table) {
        table_stack.push(0);
        i += 2 + table.size();
      } else if (i + 1 + (int)td.size() <= n &&
                 s.substr(i + 1, td.size()) == td) {
        int curr_size = table_stack.top();
        table_stack.pop();
        curr_size++;
        table_stack.push(curr_size);
        i += 2 + td.size();
      } else {
        while (s[i] != '>') i++;
        i++;
      }
    }
  }
  sort(ans.begin(), ans.end());
  for (size_t i = 0; i < ans.size(); i++) cout << ans[i] << ' ';
}
int main() {
  string s = "";
  string r;
  while (getline(cin, r, '\n')) {
    s += r;
  }
  solve(s);
  return 0;
}
