import java.util.*; public class Main { static final Scanner s = new Scanner(System.in); public static void main(String args[]){ char[] in = s.next().replaceAll("\\(\\^\\^\\*\\)", "l").replaceAll("\\(\\*\\^\\^\\)", "r").toCharArray(); int l=0,r=0; for(int i=0;i