#(#(#((##((()))(((#)(#()#(((()()(()#(##(((()(((()))#(((((()(((((((()#((#((()(#(((()(()##(()(((()((#(
 (#((((()
 (#((
 ((#)((#)((#)((#)((#)((#)((#)((#)((#)((#)((#)((#)((#)((#)((#)((##
 (())((((#)
 (#(
 (#))(#(#)((((#(##((#(#((((#(##((((((#((()(()(())((()#((((#((()((((#(((((#(##)(##()((((()())(((((#(((
 ##((((((()
 #((#
 #))))
 (((((#(#(#(#()
 ((#(()#(##
 (((((((((((((((((((###################
 )((##((###
 (((()#(#)(
 ((#)(
 )(((())#
 ()((#((#(#()
 ((#(
 ()#(#())()()#)(#)()##)#((()#)((#)()#())((#((((((((#)()()(()()(((((#)#(#((((#((##()(##(((#(()(#((#))#

-1
 -1
 -1
 1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
 3
 -1
 -1
 -1
 -1
 -1
 1
1
1
5
 1
1
1
1
 1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
 -1
 -1
 -1
 -1
 1
1
3
 -1
 -1

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.ArrayList;

public class Treasure {

    public static int numberOfRequeredBrachets(String string, int x) {

        int leftHand = 0;
        int rightHand = 0;
        int index = x - 1;
        while (true) {
            if (index < 0) {
                break;
            }
            if (string.charAt(index) == ')' || string.charAt(index) == '#') {
                break;
            }
            if (string.charAt(index) == '(') {
                leftHand++;
            }
            index--;
        }
        int index2 = x + 1;
        while (true) {
            if (index2 >= string.length()) {
                break;
            }
            if (string.charAt(index2) == '(' || string.charAt(index2) == '#') {
                break;
            }
            if (string.charAt(index2) == ')') {
                rightHand++;
            }
            index2++;
        }
        if (leftHand > rightHand) {
            return Math.abs(leftHand - rightHand);
        }
        return -1;
    }

    public static void main(String[] args) throws IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(
                System.in));
        String string = reader.readLine();
        ArrayList<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < string.length(); i++) {
            if (string.charAt(i) == '#') {
                list.add(i);
            }
        }

        for (Integer index : list) {
            System.out.println(numberOfRequeredBrachets(string, index));
        }
    }
}
