//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp> 
//using namespace __gnu_pbds; 
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define dd double
#define ld long double
#define ull unsigned long long
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define el "\n"
#define Arwa ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fix(x) cout << fixed << setprecision(x)
#define all(v) v.begin(),v.end()
void file() 
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
bool prime(int n) {
    if (n == 2) return true;
    if (n % 2 == 0 || n == 1) return false;
    for (int i = 3; i * i <= n; i += 2)
        if (n % i == 0) return false;
    return true;
}
//Here We Go Again
int32_t main() 
{
    Arwa
    //file();
    int t=1;
    //cin>>t;
    while(t--) 
    {
      stack<int>st;
      vector<int>v;
      bool f=0;
      string s;
      int mx=0,minind=-1,maxind=-1;
      cin>>s;
      for(int i=0;i<s.length();i++)
      {
            if(s[i]=='{'||s[i]=='('||s[i]=='['||s[i]=='<')
            st.push(i);
            else if(!st.empty()&&(s[i]=='}'&&s[st.top()]=='{')||(s[i]==')'&&s[st.top()]=='(')||(s[i]==']'&&s[st.top()]=='[')||(s[i]=='>'&&s[st.top()]=='<'))
            {
            minind=st.top();
            maxind=i;
            st.pop();
            if(st.empty())
            mx=maxind-minind+1;
            }
            else
            {
                if(mx!=0)
                {
                v.push_back(mx);
                mx=0;
                }
                v.push_back(0);
            }
      }
      if(mx!=0)
      v.push_back(mx);
      for(auto it:v)
      cout<<it<<' '; 
    }
    return 0;
}
















