#include <bits/stdc++.h>
using namespace std;
int main() {
  string temp, all;
  vector<int> ans;
  while (cin >> temp) all += temp;
  all += "            ";
  string a = "<table>", b = "</table>", c = "<td>", d = "</td>";
  for (int i = 0; i + (int)a.size() - 1 < (int)all.size(); i++) {
    if (all.substr(i, (int)a.size()) == a) {
      int num = 0, sum = 1;
      for (int j = i + 1; j + (int)a.size() - 1 < (int)all.size(); j++) {
        if (all.substr(j, (int)a.size()) == a)
          sum++;
        else if (all.substr(j, (int)b.size()) == b)
          sum--;
        if (sum == 0 && all.substr(j, (int)b.size()) == b) {
          int s = 0;
          for (int k = i + (int)a.size(); k < j; k++) {
            if (all.substr(k, (int)a.size()) == a)
              s++;
            else if (all.substr(k, (int)b.size()) == b)
              s--;
            if (s == 0 && all.substr(k, (int)c.size()) == c) num++;
          }
          break;
        }
      }
      ans.push_back(num);
    }
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < (int)ans.size() - 1; i++) cout << ans[i] << " ";
  cout << ans[(int)ans.size() - 1] << endl;
  return 0;
}
