//#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;
}
Ly8jaW5jbHVkZSA8ZXh0L3BiX2RzL2Fzc29jX2NvbnRhaW5lci5ocHA+IAovLyNpbmNsdWRlIDxleHQvcGJfZHMvdHJlZV9wb2xpY3kuaHBwPiAKLy91c2luZyBuYW1lc3BhY2UgX19nbnVf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aSA8PSBuOyBpICs9IDIpCiAgICAgICAgaWYgKG4gJSBpID09IDApIHJldHVybiBmYWxzZTsKICAgIHJldHVybiB0cnVlOwp9Ci8vSGVyZSBXZSBHbyBBZ2FpbgppbnQzMl90IG1haW4oKSAKewogICAgQXJ3YQogICAgLy9maWxlKCk7CiAgICBpbnQgdD0xOwogICAgLy9jaW4+PnQ7CiAgICB3aGlsZSh0LS0pIAogICAgewogICAgICBzdGFjazxpbnQ+c3Q7CiAgICAgIHZlY3RvcjxpbnQ+djsKICAgICAgYm9vbCBmPTA7CiAgICAgIHN0cmluZyBzOwogICAgICBpbnQgbXg9MCxtaW5pbmQ9LTEsbWF4aW5kPS0xOwogICAgICBjaW4+PnM7CiAgICAgIGZvcihpbnQgaT0wO2k8cy5sZW5ndGgoKTtpKyspCiAgICAgIHsKICAgICAgICAgICAgaWYoc1tpXT09J3snfHxzW2ldPT0nKCd8fHNbaV09PSdbJ3x8c1tpXT09JzwnKQogICAgICAgICAgICBzdC5wdXNoKGkpOwogICAgICAgICAgICBlbHNlIGlmKCFzdC5lbXB0eSgpJiYoc1tpXT09J30nJiZzW3N0LnRvcCgpXT09J3snKXx8KHNbaV09PScpJyYmc1tzdC50b3AoKV09PScoJyl8fChzW2ldPT0nXScmJnNbc3QudG9wKCldPT0nWycpfHwoc1tpXT09Jz4nJiZzW3N0LnRvcCgpXT09JzwnKSkKICAgICAgICAgICAgewogICAgICAgICAgICBtaW5pbmQ9c3QudG9wKCk7CiAgICAgICAgICAgIG1heGluZD1pOwogICAgICAgICAgICBzdC5wb3AoKTsKICAgICAgICAgICAgaWYoc3QuZW1wdHkoKSkKICAgICAgICAgICAgbXg9bWF4aW5kLW1pbmluZCsxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWYobXghPTApCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2LnB1c2hfYmFjayhteCk7CiAgICAgICAgICAgICAgICBteD0wOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdi5wdXNoX2JhY2soMCk7CiAgICAgICAgICAgIH0KICAgICAgfQogICAgICBpZihteCE9MCkKICAgICAgdi5wdXNoX2JhY2sobXgpOwogICAgICBmb3IoYXV0byBpdDp2KQogICAgICBjb3V0PDxpdDw8JyAnOyAKICAgIH0KICAgIHJldHVybiAwOwp9CgoKCgoKCgoKCgoKCgoKCgo=