#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-10;
int main() {
  string str, input = "";
  while (cin >> str) {
    input += str;
  }
  stack<string> st;
  vector<int> res;
  int index = 0;
  while (index < input.size()) {
    if (input[index] == '<') {
      int i = input.find(">", index);
      string tag = input.substr(index, i - index + 1);
      if (tag == "</table>") {
        res.push_back(0);
        bool f = true;
        while (f) {
          if (st.top() == "<td>")
            res[res.size() - 1]++;
          else if (st.top() == "<table>")
            f = false;
          st.pop();
        }
      } else {
        st.push(tag);
      }
      index += i - index + 1;
    } else
      index++;
  }
  sort(res.begin(), res.end(), greater<int>());
  for (int i = res.size() - 1; i >= 0; i--) {
    cout << res[i];
    if (i != 0) cout << " ";
  }
  return 0;
}
