#include <bits/stdc++.h>
using namespace std;
template <typename T, typename T2>
T2 fac(T n) {
  return n < 2 ? 1 : fac<T, T2>(n - 1) * n;
}
template <typename T, typename T2, typename T3>
T2 fac(T n, T3 mod) {
  return n < 2 ? 1 : (fac<T, T2, T3>(n - 1, mod) * n) % mod;
}
template <typename T>
T nb_combinaisons(T k, T n) {
  if (n < k) return nb_combinaisons<T>(n, k);
  return fac<T, long long int>(n) /
         (fac<T, long long int>(n - k) * fac<T, long long int>(k));
}
template <typename T, typename T2>
T nb_permutations(vector<T2> v) {
  T total = fac<T, T>(v.size());
  map<T2, T> m;
  bool distinct = true;
  for (long long unsigned c = 0; c < v.size(); c++) {
    m[v[c]]++;
    if (m[v[c]] - 1) distinct = false;
  }
  for (typename map<T2, T>::iterator it = m.begin(); it != m.end(); it++)
    total /= fac<T, T>(it->second);
  return total;
}
template <typename T, typename T2, typename T3>
T nb_permutations(vector<T2> v, T3 mod) {
  T total = fac<T, T, T3>(v.size(), mod);
  map<T2, T> m;
  bool distinct = true;
  for (long long unsigned c = 0; c < v.size(); c++) {
    m[v[c]]++;
    if (m[v[c]] - 1) distinct = false;
  }
  for (typename map<T2, T>::iterator it = m.begin(); it != m.end(); it++)
    total /= fac<T, T>(it->second);
  return total % mod;
}
string itoa_2(long long int n) {
  string s;
  stringstream ss;
  ss << n;
  ss >> s;
  while (s.size() != 9) s = '0' + s;
  return s;
}
int pgcd(int a, int b) {
  if (a == 0) return b;
  if (b == 0) return a;
  return pgcd(b, a % b);
}
string conversion(int n, int base) {
  string res = "";
  while (n != 0) {
    res = ((char)('0' + n % base)) + res;
    n /= base;
  }
  return res;
}
long long int pow2(int a, int n) {
  int res = 1;
  for (int c = 0; c < a; c++) res *= n;
  return res;
}
string rotate(string s, int n) {
  string res = s;
  for (int c = 0; c < s.size(); c++) res[c] = s[(c + n) % s.size()];
  return res;
}
int main() {
  string s = "";
  while (!cin.eof()) {
    string s2;
    getline(cin, s2);
    s = s + s2;
  }
  int table_prec[5000];
  vector<int> tables(5000);
  for (int c = 0; c < 5000; c++) tables[c] = table_prec[c] = 0;
  ;
  int table_act = 0;
  for (int c = 0; c < s.size(); c++) {
    if (s[c] == '<' || s[c] == '>' || s[c] == 't' || s[c] == 'r') continue;
    if (s[c] == 'a') {
      int temp = table_act;
      while (tables[table_act] != 0) table_act++;
      table_prec[table_act] = temp;
      c += 2;
    } else if (s[c] == 'd') {
      tables[table_act]++;
      c++;
    } else if (s[c] == '/') {
      if (s[c + 2] == 'a') {
        table_act = table_prec[table_act];
        c += 4;
      } else {
        c += 2;
      }
    }
  }
  sort(tables.begin(), tables.end());
  int c = 0;
  while (tables[c] == 0 && c < tables.size()) c++;
  for (int c2 = c; c2 < tables.size(); c2++) cout << tables[c2] << " ";
}
