#include <bits/stdc++.h>
using namespace std;
string buffer, s;
multiset<int> ans;
int partner[10000000];
int get(int l, int r) {
  ++l, --r;
  int c = 0;
  while (l < r) {
    int d = (int)s[l] - '3';
    if (d == -3) {
      ans.insert(get(l, partner[l]));
      l = partner[l] + 1;
    } else {
      if (d == -1) {
        c++;
      }
      l++;
    }
  }
  return c;
}
void replace(string a, string b) {
  int f = 0;
  while ((f = s.find(a, f)) != string::npos) {
    s.replace(f, a.length(), b);
  }
}
int main() {
  while (cin >> buffer) s.append(buffer);
  replace(" ", "");
  replace("<table>", "0");
  replace("</table>", "6");
  replace("<tr>", "1");
  replace("</tr>", "5");
  replace("<td>", "2");
  replace("</td>", "4");
  stack<int> st;
  for (int i = 0; i < s.length(); ++i) {
    int d = s[i] - '3';
    if (d < 0) {
      st.push(i);
    } else {
      partner[st.top()] = i;
      partner[i] = st.top();
      st.pop();
    }
  }
  for (int i = 0; i < s.length(); i = partner[i] + 1) {
    ans.insert(get(i, partner[i]));
  }
  for (multiset<int>::iterator it = ans.begin(); it != ans.end(); ++it)
    cout << (it == ans.begin() ? "" : " ") << *it;
  cout << endl;
}
