#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long inf64 = 0x3f3f3f3f3f3f3f3fLL;
const long double pi = 3.14159265358979;
const long double eps = 1e-7;
int main() {
  string table;
  while (true) {
    string s;
    cin >> s;
    if (feof(stdin)) break;
    table += s;
  }
  for (int i = 0; i < table.length(); i++)
    if (table[i] == '<' || table[i] == '>') table[i] = ' ';
  vector<int> ans;
  int curtablev = 0;
  istringstream ss(table);
  string tmp;
  stack<int> curtable;
  while (ss >> tmp) {
    if (tmp == "table") {
      curtable.push(curtablev++);
      ans.push_back(0);
    } else if (tmp == "/table") {
      curtable.pop();
    } else if (tmp == "td") {
      ans[curtable.top()]++;
    }
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << ' ';
  cout << endl;
  return 0;
}
