using System;
using System.Collections.Generic;
public class Program
{
public static void Main()
var arr = new string[]{")",")","(","(","(",")"};
var newarr = new string[12];
var list = new List<string>();
int k=0;
int count = 0;
PrintArray(arr);
for(int i=0;i<arr.Length-1;i++)
if(arr[i] == ")")
if(count==0)
newarr[k++] = "(";
newarr[k++] = ")";
}
else
count--;
count++;
for(int i=0;i<count;i++)
PrintArray(newarr);
public static void PrintArray(string[] arr)
foreach(var i in arr)
Console.Write(i + " ");
Console.WriteLine("");