#include <bits/stdc++.h>
using namespace std;
int main() {
  string line, text;
  stack<int> tables;
  vector<int> res;
  while (cin >> line) {
    text += line;
  }
  string temp;
  for (int i = 0; i < text.size(); i++) {
    temp += text[i];
    if (text[i] == '>') {
      if (temp == "<table>")
        tables.push(0);
      else if (temp == "</table>")
        res.push_back(tables.top()), tables.pop();
      else if (temp == "</td>")
        tables.top()++;
      temp.clear();
    }
  }
  sort(res.begin(), res.end());
  for (int i = 0; i < res.size(); i++) {
    if (i > 0) cout << " ";
    cout << res[i];
  }
  cout << endl;
  return 0;
}
