#include <bits/stdc++.h>
using namespace std;

string str;
#define MXN 200005
typedef long long ll;

int N;
ll TOT[MXN], DP[MXN];
int rec[MXN], mt[MXN], popp[MXN];

int main()
{
    cin>>str;
    N = str.size();
    int pos = 0;
    deque<int> stk;

    for(int i = 1; i <= N; i++)
    {
        if(str[i-1]=='-')
        {
            deque<int> rst;//restore stack
            int att=pos, cnt = 0;
            while( i<=N && str[i-1]=='-' )
            {
                cnt++;
                pos--;
                cout<<TOT[pos]<<'\n';
                i++;
            }
            //restore
            i--;
            int l = att-cnt+1, r = att;
            for( int j = r; j >= l; j-- )
            {
                if( !stk.empty() && stk.back()==j )stk.pop_back();
            }
            for( int j = r; j >= l; j-- )
            {
                if( rec[j]==2 && mt[j]>0 && mt[j]<l )
                {
                    stk.push_back( mt[j] );
                }
            }
        }
        else if(str[i-1]=='(')
        {
            pos++;
            rec[pos] = 1;
            DP[pos] = 0;
            stk.push_back(pos);
            popp[pos] = 0;
            TOT[pos] = TOT[pos-1];
        }
        else
        {
            pos++;
            rec[pos] = 2;
            if(stk.empty())
            {
                DP[pos] = 0;
                mt[pos] = 0;
                TOT[pos] = TOT[pos-1];
            }
            else
            {
                assert( !(pos==1 && !stk.empty()) );
                int lf = stk.back();
                stk.pop_back();
                mt[pos] = lf;
                popp[lf] = 1;
                DP[pos] = DP[lf-1]+1;
                TOT[pos] = TOT[pos-1]+DP[pos];
            }
        }
        if(str[i-1]!='-')cout<<TOT[pos]<<'\n';
    }

    return 0;
}

/*

()--()()----)(()()))

*/

