#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  while (cin >> t) s += t;
  vector<string> str;
  int pos = 0;
  vector<int> a, ans;
  while (pos != ((int)(s).size())) {
    if (s.substr(pos, 7) == "<table>") {
      a.push_back(0);
      pos += 7;
    } else if (s.substr(pos, 4) == "<tr>")
      pos += 4;
    else if (s.substr(pos, 4) == "<td>") {
      ++a.back();
      pos += 4;
    } else if (s.substr(pos, 5) == "</td>")
      pos += 5;
    else if (s.substr(pos, 5) == "</tr>")
      pos += 5;
    else if (s.substr(pos, 8) == "</table>") {
      ans.push_back(a.back());
      a.pop_back();
      pos += 8;
    }
  }
  sort((ans).begin(), (ans).end());
  for (int(i) = 0; (i) < (((int)(ans).size())); ++(i)) cout << ans[i] << " ";
  return 0;
}
