#include <bits/stdc++.h>
using namespace std;
vector<int> arr;
stack<int> st;
pair<int, int> nxt(string str, pair<int, int> prev) {
  int pos = prev.first;
  int pos1 = str.find("<table>", pos);
  int pos2 = str.find("<td>", pos);
  int pos3 = str.find("</table", pos);
  if (pos1 == string::npos) pos1 = 2147483647;
  if (pos2 == string::npos) pos2 = 2147483647;
  if (pos3 == string::npos) pos3 = 2147483647;
  if (pos1 < pos2 && pos1 < pos3)
    return make_pair((pos1), (0));
  else if (pos2 < pos3)
    return make_pair((pos2), (1));
  else
    return make_pair((pos3), (2));
}
int main() {
  string str;
  while (true) {
    string in;
    cin >> in;
    if (cin.eof()) break;
    str += in;
  }
  pair<int, int> pos = make_pair((0), (0));
  while ((pos = nxt(str, pos)).first != 2147483647) {
    pos.first++;
    if (pos.second == 0) {
      st.push(arr.size());
      arr.push_back(0);
    } else if (pos.second == 1) {
      arr[st.top()]++;
    } else if (pos.second == 2) {
      st.pop();
    }
  }
  sort(arr.begin(), arr.end());
  for (int i = 0; i < arr.size(); i++)
    printf("%d%c", arr[i], i == arr.size() - 1 ? '\n' : ' ');
  return 0;
}
