#include <bits/stdc++.h>
const double EPS = 1e-9;
const int INT_INF = 1 << 31 - 1;
const long long I64_INF = 1ll << 63 - 1ll;
const double PI = acos(-1.0);
using namespace std;
vector<int> r;
string second;
void ReadTable(int id, int& FinalId);
string GetTag(int id) {
  string res = "";
  id++;
  while (second[id] != '>') res += second[id], id++;
  return res;
}
void ReadTd(int id, int& FinalId) {
  string tag = GetTag(id);
  while (tag != "/td") {
    int NewId;
    ReadTable(id + 7, NewId);
    id = NewId;
    tag = GetTag(id);
  }
  FinalId = id + 5;
}
int ReadTr(int id, int& FinalId) {
  int res = 0;
  string tag = GetTag(id);
  while (tag != "/tr") {
    int NewId;
    ReadTd(id + 4, NewId);
    id = NewId;
    res++;
    tag = GetTag(id);
  }
  FinalId = id + 5;
  return res;
}
void ReadTable(int id, int& FinalId) {
  int res = 0;
  string tag = GetTag(id);
  while (tag != "/table") {
    int NewId;
    res += ReadTr(id + 4, NewId);
    id = NewId;
    tag = GetTag(id);
  }
  FinalId = id + 8;
  r.push_back(res);
}
int main() {
  char c;
  second.clear();
  while (scanf("%c", &c) >= 1)
    if (c != ' ' && c != '\n') second += c;
  int loose;
  ReadTable(7, loose);
  sort(r.begin(), r.end());
  for (int i = 0; i < (int)r.size(); i++) printf("%d ", r[i]);
  return 0;
}
