#include <bits/stdc++.h>
int IntMaxVal = (int)1e20;
int IntMinVal = (int)-1e20;
long long LongMaxVal = (long long)1e20;
long long LongMinVal = (long long)-1e20;
using namespace std;
template <typename T>
struct argument_type;
template <typename T, typename U>
struct argument_type<T(U)> {};
template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& s) {
  is >> s.first >> s.second;
  return is;
}
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  vector<int> ans;
  vector<int> cur;
  string s;
  string stemp;
  while (cin >> stemp) s += stemp;
  const int TD = 1;
  const int TR = 2;
  const int TABLE = 3;
  for (int i = 0; i < s.length(); ++i) {
    int end = i + 1;
    while (s[end] != '>') end++;
    i++;
    bool isClosing = s[i] == '/';
    if (isClosing) i++;
    int U;
    if (s[i + 1] == 'a')
      U = TABLE;
    else if (s[i + 1] == 'r')
      U = TR;
    else
      U = TD;
    if (isClosing && U == TD)
      cur.back()++;
    else if (isClosing && U == TABLE) {
      ans.push_back(cur.back());
      cur.pop_back();
    } else if (U == TABLE)
      cur.push_back(0);
    i = end;
  }
  sort(ans.begin(), ans.end());
  for (auto x : ans) cout << x << ' ';
}
