using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Magatro { static string S = Console.ReadLine(); const string Right="*^^"; const string Left = "^^*"; static void Main() { int R = 0; int L = 0; for(int i = 0; i < S.Length; i++) { if (S[i] == '(') { int lcnt = 0;int rcnt = 0; bool l = false, r = false; for(int j = i + 1; j < S.Length; j++) { if (rcnt == 3) { r = true; } else { if (S[j] == Right[rcnt]) { rcnt++; } } if (lcnt == 3) { l = true; } else { if (S[j] ==Left[lcnt]) { lcnt++; } } if (S[j] == ')') { if (r) { R++; } if (l) { L++; } } } } } Console.WriteLine("{0} {1}", L, R); } }