#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define ALL(x) x.begin(),x.end()
 
template <typename T>
void cetak(T t){cout << t << ')' << endl;}
template <typename T, typename... V>
void cetak(T t, V... v) {cout << t; if (sizeof...(v)) cerr << ", "; cetak(v...);}
 
#define debug(x...) cout<< '(' << #x << ") = ("; cetak(x) 
#define sz(x) (int)(x.size())
#define lt(x) (int)(x.length())

const int MOD = 1e9 + 7;
const int mx = 5e5 + 10;

int ini[mx];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string ss;
    cin >> ss;
    int balance = 0;
    long long jaw = 0;
    string itu;
    stack<int> s;
    for(int i = 0; i < sz(ss); i++){
        if(ss[i] == '('){
            balance += 1;
            ini[balance + 200000] += 1;
            itu += ss[i];
        }
        else if(ss[i] ==')'){
            jaw += ini[balance + 200000];
            itu += ss[i];
            s.push(ini[balance + 1 + 200000]);
            ini[balance + 1 + 200000] = 0;
            balance -= 1;
        }
        else{
            if(itu.back() == '('){
                itu.pop_back();
                ini[balance + 200000] -= 1;
                balance -= 1;
            }
            else{
                balance += 1;
                ini[balance + 1 + 200000] = s.top();
                s.pop();
                itu.pop_back();
                jaw -= ini[balance + 200000];
            }
        }
        cout << jaw << '\n';
    }
}
