#include <bits/stdc++.h>
using namespace std;
int main() {
  string str = "", ret;
  stack<int> s;
  vector<int> v;
  int p, st, ch = 0;
  while (cin >> ret) {
    str += ret;
  }
  p = str.length();
  st = 0;
  for (int i = 0; i < p; i++) {
    if (st == 0 && str[i] == '<')
      st = 1;
    else if (st == 1 && str[i] == '/') {
      st = 2;
      ch = 1;
    } else if (st == 1 && str[i] == 't')
      st = 3;
    else if (st == 3 && str[i] == 'a') {
      s.push(0);
      st = 4;
    } else if (st == 3 && str[i] == 'd')
      (s.top())++;
    else if (st == 4 && (str[i] == 'b' || str[i] == 'l' || str[i] == 'e'))
      st = 4;
    else if ((st == 7 || st == 8 || st == 10) && str[i] == '>' && ch == 1) {
      if (st == 7 && s.empty() == false) {
        v.push_back(s.top());
        s.pop();
      }
      ch = 0;
      st = 0;
    } else if (st == 3 && str[i] == 'd')
      st = 0;
    else if (st == 2 && str[i] == 't')
      st = 9;
    else if (st == 9 && str[i] == 'a')
      st = 7;
    else if (st == 7 && (str[i] == 'b' || str[i] == 'l' || str[i] == 'e'))
      st = 7;
    else if (st == 9 && str[i] == 'r')
      st = 8;
    else if (st == 9 && str[i] == 'd')
      st = 10;
    else
      st = 0;
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << endl;
  return 0;
}
