#include <bits/stdc++.h>
using namespace std;
stack<pair<int, int> > st;
vector<pair<int, int> > v;
string s1[100];
int main() {
  long long ans = 0;
  ios::sync_with_stdio(false);
  int x = 0;
  string s;
  bool f = 0;
  for (int i = 0; i < 13; i++) {
    cin >> s1[i];
    for (int j = 0; j < s1[i].size(); j++) {
      s += s1[i][j];
      if (s == "<table>") {
        st.push(make_pair(0, x));
        x++;
        s.clear();
        f = 1;
      }
      if (s == "<td>") {
        st.top().first++;
        s.clear();
      }
      if (s == "</table>") {
        v.push_back(st.top());
        st.pop();
        s.clear();
      }
      if (s[0] == '<' && s[s.size() - 1] == '>') s.clear();
    }
    if (st.empty() && f == 1) break;
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    cout << v[i].first << " ";
  }
}
