import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String S = scan.next(); scan.close(); int l = S.length(); int R = 0; int L = 0; int t1 = 0; int t2 = 0; for(int i = 0; i < l; i++) { if(S.charAt(i) == '(') { t1 = 0; t2 = 0; for(int j = i + 1; j < l; j++) { if(S.charAt(j) == '*') { if(t1 == 0) t1++; if(t2 == 2) t2++; }else if(S.charAt(j) == '^') { if(t1 == 1 || t1 == 2) t1++; if(t2 == 0 || t2 == 1) t2++; }else if(S.charAt(j) == ')') { if(t1 == 3) L++; if(t2 == 3) R++; } } } } System.out.println(R +" " + L); } }