#include <bits/stdc++.h>
using namespace std;
int main() {
  char c[5001];
  int t, p = 0;
  while ((t = getchar()) != EOF)
    if ((char)t != ' ' && (char)t != '\n') c[p++] = (char)t;
  int l = 0;
  vector<int> st, tables;
  for (int i = 0; i < p; i++) {
    if (c[i] == '<')
      l = i;
    else if (c[i] == '>') {
      c[i] = 0;
      if (!strcmp(c + l, "<table"))
        st.push_back(0);
      else if (!strcmp(c + l, "</table")) {
        int t = st.back();
        st.pop_back();
        tables.push_back(t);
      } else if (!strcmp(c + l, "</td"))
        st.back()++;
    }
  }
  sort(tables.begin(), tables.end());
  for (int i = 0; i < tables.size(); i++) printf("%d ", tables[i]);
  return 0;
}
