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

-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.util.*;

public class Treasure494A
{
    public static void main(String[] args) 
    {
        // Set up scanner
        Scanner sc = new Scanner(System.in); 
        // System.out.println("Enter string");
        String st = sc.next();
        
        int totalpcount = 0;
        int totalpslots = 0;
        for (int i=0; i<st.length(); i++)
        {
            String ch = st.substring(i,i+1);
            if (ch.equals("#"))
            {
                totalpslots++;
            }
            else if (ch.equals("("))
            {
                totalpcount++;
            }
            else
            {
                totalpcount--;
            }
        }
        
        if (totalpcount <= 0 || totalpslots > totalpcount)
        {
            System.out.println(-1);
            return;
        }
        
        int excessleft = 0;
        for (int i=0; i<st.length(); i++)
        {
            String ch = st.substring(i,i+1);
            if (ch.equals("("))
            {
                excessleft++;
            }
            else if (ch.equals(")"))
            {
                excessleft--;
            }
            if (ch.equals("#"))
            {
                if (totalpslots == 1)
                {
                    // Can we fit all the rest in?
                    if (totalpcount >= excessleft)
                    {
                        System.out.println(totalpcount);
                        return;
                    }
                    else
                    {
                        System.out.println(-1);
                        return;
                    }
                }
                else
                {
                    // Can we fit even a single one?
                    if (excessleft <= 0)
                    {
                        System.out.println(-1);
                        return;
                    }
                    else
                    {
                        System.out.println(1);
                        excessleft--;
                        totalpslots--;
                        totalpcount--;
                    }
                }
            }
        }
    }
}
            
            
            
        
        
        

                