#include <bits/stdc++.h>
using namespace std;
vector<int> answer;
string str;
int pre[5000];
int f(int i, int j) {
  if (i >= j) return 0;
  if (str[i] == '(') {
    answer.push_back(f(i + 1, pre[i] - 1));
    return 0;
  }
  if (str[i] == '[') {
    int cnt = 0;
    while (i < j) {
      cnt += f(i + 1, pre[i] - 1);
      i = pre[i] + 1;
    }
    return cnt;
  }
  if (str[i] == '{') {
    int cnt = 0;
    while (i < j) {
      cnt += f(i + 1, pre[i] - 1) + 1;
      i = pre[i] + 1;
    }
    return cnt;
  }
  return 0;
}
void replace(string word, char c) {
  vector<int> v;
  int cnt = 0;
  for (int i = 0; i <= str.size() - word.size(); i++)
    if (str.substr(i, word.size()) == word) v.push_back(i);
  for (int i = 0; i < v.size(); i++) {
    str = str.substr(0, v[i] - cnt * word.size() + cnt) + c +
          str.substr(v[i] + word.size() - cnt * word.size() + cnt);
    cnt++;
  }
}
int main() {
  string t;
  while (cin >> t) str += t;
  replace("<table>", '(');
  replace("</table>", ')');
  replace("<tr>", '[');
  replace("</tr>", ']');
  replace("<td>", '{');
  replace("</td>", '}');
  stack<int> S;
  for (int i = 0; i < str.size(); i++)
    if (str[i] == '(' || str[i] == '{' || str[i] == '[')
      S.push(i);
    else {
      pre[S.top()] = i;
      S.pop();
    }
  f(0, str.size());
  sort(answer.begin(), answer.end());
  for (int i = 0; i < answer.size(); i++) {
    cout << answer[i];
    if (i + 1 != answer.size()) cout << " ";
  }
  cout << endl;
  return 0;
}
