#include <bits/stdc++.h>
using namespace std;
string real_final_input;
long long num_par = 0;
vector<long long> ans;
string concatenate(vector<string>& input) {
  string final_input;
  for (long long i = 0; i < input.size(); i++) final_input += input[i];
  return final_input;
}
long long re(long long start) {
  long long sum = 0, i, num = num_par;
  ans.push_back(0);
  for (i = start; real_final_input[i] != ')'; i++) {
    if (real_final_input[i] == '[')
      sum++;
    else if (real_final_input[i] == '(') {
      num_par++;
      i = re(i + 1);
    }
  }
  ans[num] = sum;
  return i;
}
int main() {
  string table = "<table>", holder, final_input;
  vector<string> input;
  while (cin >> holder) input.push_back(holder);
  final_input = concatenate(input);
  holder = "";
  for (long long i = 0; i < final_input.size(); i++) {
    holder.push_back(final_input[i]);
    if (holder == "<table>")
      real_final_input.push_back('('), holder = "";
    else if (holder == "</table>")
      real_final_input.push_back(')'), holder = "";
    else if (holder == "<tr>")
      real_final_input.push_back('{'), holder = "";
    else if (holder == "</tr>")
      real_final_input.push_back('}'), holder = "";
    else if (holder == "<td>")
      real_final_input.push_back('['), holder = "";
    else if (holder == "</td>")
      real_final_input.push_back(']'), holder = "";
  }
  re(1);
  sort(ans.begin(), ans.end());
  for (long long i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
