#include <bits/stdc++.h>
using namespace std;
multiset<long long int> ans;
stack<long long int> table;
int main() {
  std::ios::sync_with_stdio(false);
  string s = "";
  string str;
  long long int i = 0;
  while (cin >> str) {
    s += str;
    i++;
    if (i == 10) break;
  }
  long long int l = 0;
  long long int si = s.size();
  while (l < si) {
    if (s[l + 1] == '/') {
      if (s.substr(l, 5) == "</td>")
        l += 5;
      else if (s.substr(l, 5) == "</tr>")
        l += 5;
      else if (s.substr(l, 8) == "</table>") {
        l += 8;
        ans.insert(table.top());
        table.pop();
      }
    } else {
      if (s.substr(l, 4) == "<td>") {
        l += 4;
        table.top()++;
      } else if (s.substr(l, 4) == "<tr>")
        l += 4;
      else if (s.substr(l, 7) == "<table>") {
        table.push(0);
        l += 7;
      }
    }
  }
  for (auto e : ans) cout << e << " ";
  return 0;
}
