using System.Collections;
public static void Main()
var s = "(*()()())(((*(()((((()())()()*()(())))))(((*(()*)())((())))(((()))))*)))((()())(*())**((())))(*)";
s = "(*)(((*((((*))))(((*(*))))*)))";
while( s.IndexOf("()") >= 0 )
var stack1 = new Stack();
var stack2 = new Stack();
for(var i = 0; i < s.Length; ++i)
if(s[i] == '*') {stack2.Push('*');++count3;}
if( stack1.Count == 0) stack2.Clear();
else if( stack1.Count > 0 && stack2.Count >0 ) {
if (count1 + count3 >= count2) continue;
Console.WriteLine(s.Substring(0,i+1));
if(b) b = (stack1.Count == 0) || (stack1.Count <= stack2.Count) ;
Console.WriteLine(count1);
Console.WriteLine(count2);
Console.WriteLine(count3);