#include <bits/stdc++.h>
using namespace std;
int closing[5000];
vector<int> res;
string html;
int countTable(int s, int e);
int countCell(int s, int e) {
  s += 4;
  e -= 5;
  if (s < e) {
    int t = countTable(s, e);
    res.push_back(t);
  }
  return 0;
}
int countRow(int s, int e) {
  s += 4;
  e -= 5;
  int co = 0;
  while (s < e) {
    co++;
    co += countCell(s, closing[s]);
    s = closing[s] + 1;
  }
  return co;
}
int countTable(int s, int e) {
  s += 7;
  e -= 8;
  if (e <= s) return 0;
  int co = 0;
  while (s < e) {
    co += countRow(s, closing[s]);
    s = closing[s] + 1;
  }
  return co;
}
int main() {
  string line;
  while (getline(cin, line)) html += line;
  stack<int> s;
  for (int i = 0; i < html.size(); i++) {
    if (html[i] == '<') {
      if (html[i + 1] == '/') {
        while (html[i] != '>') i++;
        int ind = s.top();
        s.pop();
        closing[ind] = i;
      } else {
        s.push(i);
      }
    }
  }
  res.push_back(countTable(0, html.size() - 1));
  sort(res.begin(), res.end());
  cout << res[0];
  for (int i = 1; i < res.size(); i++) cout << " " << res[i];
  cout << endl;
}
