Untitled
unknown
csharp
2 years ago
54 kB
10
Indexable
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace problems3
{
public class Problems
{
string stringbase;
HashSet<string> lista = new HashSet<string>();
int izquierdaBASE;
int derechaBASE;
public IList<string> GenerateParenthesis(int n)
{
testisValid();
var index = ((n * 2) / 2) - 1;
stringbase = Primero(n);
lista.Add(stringbase);
print();
firstRound(index, lista);
izquierdaBASE = index;
derechaBASE = index + 1;
// changePosition(index - 1, index + 1, stringbase.Length);
changePositionfinal(index - 1, index + 1, stringbase.Length);
return lista.ToList();
}
public class structure
{
public List<int> indices;
public structure(List<int> param) {
this.indices = param;
hijos = new List<structure>();
}
public List<structure> hijos { get; set; }
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("-items-");
indices.ForEach(item=>sb.Append($"{item.ToString()},"));
sb.AppendLine("-----");
return sb.ToString();
}
}
string Primero(int n)
{
string first = new string('(', n);
string second = new string(')', n);
return $"{first}{second}";
}
void firstRound(int index, HashSet<string> lista)
{
for (int i = index + 1; i < stringbase.Length - 1; i++)
{
var indices = new List<int>() { index, i };
lista.Add(change(indices, stringbase));
}
}
void changePositionReverseBase(List<int> indices,int lastitemfather, int length)
{
var copy = new List<int>(indices);
// indices.Add(izquierdaBASE);
//indices.Add(derechaBASE);
int basederecha = indices.Last();
for (int z = 0; z <=1 ; z++)
{
if (z == 1) {
copy.RemoveAt(copy.Count-1);
copy.Add(lastitemfather);
}
for (int x = lastitemfather+z; x < length - 3; x++)
{
for (int i = x + 1; i < length - 1; i++)
{
var indicesInner = new List<int>(copy);
indicesInner.Add(x);
indicesInner.Add(i);
var itemparaagregar = change(indicesInner, stringbase);
if (isValid(itemparaagregar))
{
foreach (var item in indicesInner)
{
Console.Write($"{item}-");
}
Console.WriteLine();
lista.Add(itemparaagregar);
}
else
{
//if(copy.Count> 0)
//copy.RemoveAt(copy.Count - 1);
//if(copy.Count==0)
//{
// return;
//}
return;
}
}
}
}
}
void changePositionWithIzquierdaBase(List<int> indices, int length)
{
var copy = new List<int>(indices);
// indices.Add(izquierdaBASE);
//indices.Add(derechaBASE);
if(indices.Count > 2) {
bool primervuelta = false;
}
for (int x = derechaBASE; x < length - 3; x++)
{
for (int i = x + 1; i < length - 1; i++)
{
var indicesInner = new List<int>(copy);
if (indices.Count > 2)
{
indicesInner.Add(x);
indicesInner.Add(i);
}
else
{
indicesInner.Add(x);
indicesInner.Add(i);
}
var itemparaagregar = change(indicesInner, stringbase);
if (isValid(itemparaagregar))
{
foreach (var item in indicesInner)
{
Console.Write($"{item}-");
}
Console.WriteLine();
lista.Add(itemparaagregar);
}
else
{
//if(copy.Count> 0)
//copy.RemoveAt(copy.Count - 1);
//if(copy.Count==0)
//{
// return;
//}
return;
}
}
}
}
void changePositionWithIndex(List<int> indices, int length)
{
// indices.Add(izquierdaBASE);
//indices.Add(derechaBASE);
bool primervuelta = false;
for (int x = derechaBASE; x < length - 3; x++)
{
for (int i = x + 1; i < length - 1; i++)
{
var indicesInner = new List<int>(indices);
indicesInner.Add(x);
indicesInner.Add(i);
foreach (var item in indicesInner)
{
Console.Write($"{item}-");
}
Console.WriteLine();
lista.Add(change(indicesInner, stringbase));
}
}
}
void changePositionfinal(int izquierda, int derecha, int length)
{
int derechaIndex = derecha;
var indices = new SortedSet<int>() { izquierda };
var derechas = new List<int>() { };
while (izquierda > 1)
{
indices = new SortedSet<int>() { izquierda };
for (int i = derecha; i < length - 1; i++)
{
var innderIndex = new List<int>(indices) { i };
foreach (var item in innderIndex)
{
Console.Write($"{item}-");
}
Console.WriteLine();
lista.Add(change(innderIndex, stringbase));
}
var last = lista.ToList()[lista.Count-1];
var list= fillit(izquierda, derecha-1);
//if (izquierda == 4) {
// changePositionWithIzquierdaBase(new List<int>() { 4,6}, length);
// changePositionWithIzquierdaBase(new List<int>() { 4, 5 }, length);
//}
foreach (var item in list)
{
if (izquierda == 3)
{
Console.WriteLine();
}
changePositionWithIzquierdaBase(item.indices, length);
last = lista.ToList()[lista.Count - 1];
foreach (var hijo in item.hijos)
{
Console.WriteLine(hijo);
if (item.indices.Count > 2)
changePositionReverseBase(hijo.indices, derechaBASE + 2, length);
else
changePositionReverseBase(hijo.indices, derechaBASE + 1, length);
last = lista.ToList()[lista.Count - 1];
}
}
izquierda--;
}
}
string change(List<int> index, string basestring)
{
char[] ch = basestring.ToCharArray();
foreach (var item in index)
{
if (ch[item] == '(')
{
ch[item] = ')';
}
else
{
ch[item] = '(';
}
}
string resultado = new string(ch);
return resultado;
}
//string[] array = new string[] { "(((()())))", "(((())()))", "(((()))())", "(((())))()", "((()(())))", "((()()()))", "((()())())", "((()()))()", "((())(()))", "((())()())", "((())())()", "((()))(())", "((()))()()", "(()((())))", "(()(()()))", "(()(())())", "(()(()))()", "(()()(()))", "(()()()())", "(()()())()", "(()())(())", "(()())()()", "(())((()))", "(())(()())", "(())(())()", "(())()(())", "(())()()()", "()(((())))", "()((()()))", "()((())())", "()((()))()", "()(()(()))", "()(()()())", "()(()())()", "()(())(())", "()(())()()", "()()((()))", "()()(()())", "()()(())()", "()()()(())", "()()()()()" };
//string[] array = new string[] { "((()()))", "((())())", "((()))()", "(()(()))", "(()()())", "(()())()", "(())(())", "(())()()", "()((()))", "()(()())", "()(())()", "()()(())", "()()()()" };
//string[] array = new string[] { "((((()()))))", "((((())())))", "((((()))()))", "((((())))())", "((((()))))()", "(((()(()))))", "(((()()())))", "(((()())()))", "(((()()))())", "(((()())))()", "(((())(())))", "(((())()()))", "(((())())())", "(((())()))()", "(((()))(()))", "(((()))()())", "(((()))())()", "(((())))(())", "(((())))()()", "((()((()))))", "((()(()())))", "((()(())()))", "((()(()))())", "((()(())))()", "((()()(())))", "((()()()()))", "((()()())())", "((()()()))()", "((()())(()))", "((()())()())", "((()())())()", "((()()))(())", "((()()))()()", "((())((())))", "((())(()()))", "((())(())())", "((())(()))()", "((())()(()))", "((())()()())", "((())()())()", "((())())(())", "((())())()()", "((()))((()))", "((()))(()())", "((()))(())()", "((()))()(())", "((()))()()()", "(()(((()))))", "(()((()())))", "(()((())()))", "(()((()))())", "(()((())))()", "(()(()(())))", "(()(()()()))", "(()(()())())", "(()(()()))()", "(()(())(()))", "(()(())()())", "(()(())())()", "(()(()))(())", "(()(()))()()", "(()()((())))", "(()()(()()))", "(()()(())())", "(()()(()))()", "(()()()(()))", "(()()()()())", "(()()()())()", "(()()())(())", "(()()())()()", "(()())((()))", "(()())(()())", "(()())(())()", "(()())()(())", "(()())()()()", "(())(((())))", "(())((()()))", "(())((())())", "(())((()))()", "(())(()(()))", "(())(()()())", "(())(()())()", "(())(())(())", "(())(())()()", "(())()((()))", "(())()(()())", "(())()(())()", "(())()()(())", "(())()()()()", "()((((()))))", "()(((()())))", "()(((())()))", "()(((()))())", "()(((())))()", "()((()(())))", "()((()()()))", "()((()())())", "()((()()))()", "()((())(()))", "()((())()())", "()((())())()", "()((()))(())", "()((()))()()", "()(()((())))", "()(()(()()))", "()(()(())())", "()(()(()))()", "()(()()(()))", "()(()()()())", "()(()()())()", "()(()())(())", "()(()())()()", "()(())((()))", "()(())(()())", "()(())(())()", "()(())()(())", "()(())()()()", "()()(((())))", "()()((()()))", "()()((())())", "()()((()))()", "()()(()(()))", "()()(()()())", "()()(()())()", "()()(())(())", "()()(())()()", "()()()((()))", "()()()(()())", "()()()(())()", "()()()()(())", "()()()()()()" };
//string[] array = new string[] { "(()())", "(())()", "()(())", "()()()" };
string[] array7 = new string[] { "(((((()())))))", "(((((())()))))", "(((((()))())))", "(((((())))()))", "(((((()))))())", "(((((())))))()", "((((()(())))))", "((((()()()))))", "((((()())())))", "((((()()))()))", "((((()())))())", "((((()()))))()", "((((())(()))))", "((((())()())))", "((((())())()))", "((((())()))())", "((((())())))()", "((((()))(())))", "((((()))()()))", "((((()))())())", "((((()))()))()", "((((())))(()))", "((((())))()())", "((((())))())()", "((((()))))(())", "((((()))))()()", "(((()((())))))", "(((()(()()))))", "(((()(())())))", "(((()(()))()))", "(((()(())))())", "(((()(()))))()", "(((()()(()))))", "(((()()()())))", "(((()()())()))", "(((()()()))())", "(((()()())))()", "(((()())(())))", "(((()())()()))", "(((()())())())", "(((()())()))()", "(((()()))(()))", "(((()()))()())", "(((()()))())()", "(((()())))(())", "(((()())))()()", "(((())((()))))", "(((())(()())))", "(((())(())()))", "(((())(()))())", "(((())(())))()", "(((())()(())))", "(((())()()()))", "(((())()())())", "(((())()()))()", "(((())())(()))", "(((())())()())", "(((())())())()", "(((())()))(())", "(((())()))()()", "(((()))((())))", "(((()))(()()))", "(((()))(())())", "(((()))(()))()", "(((()))()(()))", "(((()))()()())", "(((()))()())()", "(((()))())(())", "(((()))())()()", "(((())))((()))", "(((())))(()())", "(((())))(())()", "(((())))()(())", "(((())))()()()", "((()(((())))))", "((()((()()))))", "((()((())())))", "((()((()))()))", "((()((())))())", "((()((()))))()", "((()(()(()))))", "((()(()()())))", "((()(()())()))", "((()(()()))())", "((()(()())))()", "((()(())(())))", "((()(())()()))", "((()(())())())", "((()(())()))()", "((()(()))(()))", "((()(()))()())", "((()(()))())()", "((()(())))(())", "((()(())))()()", "((()()((()))))", "((()()(()())))", "((()()(())()))", "((()()(()))())", "((()()(())))()", "((()()()(())))", "((()()()()()))", "((()()()())())", "((()()()()))()", "((()()())(()))", "((()()())()())", "((()()())())()", "((()()()))(())", "((()()()))()()", "((()())((())))", "((()())(()()))", "((()())(())())", "((()())(()))()", "((()())()(()))", "((()())()()())", "((()())()())()", "((()())())(())", "((()())())()()", "((()()))((()))", "((()()))(()())", "((()()))(())()", "((()()))()(())", "((()()))()()()", "((())(((()))))", "((())((()())))", "((())((())()))", "((())((()))())", "((())((())))()", "((())(()(())))", "((())(()()()))", "((())(()())())", "((())(()()))()", "((())(())(()))", "((())(())()())", "((())(())())()", "((())(()))(())", "((())(()))()()", "((())()((())))", "((())()(()()))", "((())()(())())", "((())()(()))()", "((())()()(()))", "((())()()()())", "((())()()())()", "((())()())(())", "((())()())()()", "((())())((()))", "((())())(()())", "((())())(())()", "((())())()(())", "((())())()()()", "((()))(((())))", "((()))((()()))", "((()))((())())", "((()))((()))()", "((()))(()(()))", "((()))(()()())", "((()))(()())()", "((()))(())(())", "((()))(())()()", "((()))()((()))", "((()))()(()())", "((()))()(())()", "((()))()()(())", "((()))()()()()", "(()((((())))))", "(()(((()()))))", "(()(((())())))", "(()(((()))()))", "(()(((())))())", "(()(((()))))()", "(()((()(()))))", "(()((()()())))", "(()((()())()))", "(()((()()))())", "(()((()())))()", "(()((())(())))", "(()((())()()))", "(()((())())())", "(()((())()))()", "(()((()))(()))", "(()((()))()())", "(()((()))())()", "(()((())))(())", "(()((())))()()", "(()(()((()))))", "(()(()(()())))", "(()(()(())()))", "(()(()(()))())", "(()(()(())))()", "(()(()()(())))", "(()(()()()()))", "(()(()()())())", "(()(()()()))()", "(()(()())(()))", "(()(()())()())", "(()(()())())()", "(()(()()))(())", "(()(()()))()()", "(()(())((())))", "(()(())(()()))", "(()(())(())())", "(()(())(()))()", "(()(())()(()))", "(()(())()()())", "(()(())()())()", "(()(())())(())", "(()(())())()()", "(()(()))((()))", "(()(()))(()())", "(()(()))(())()", "(()(()))()(())", "(()(()))()()()", "(()()(((()))))", "(()()((()())))", "(()()((())()))", "(()()((()))())", "(()()((())))()", "(()()(()(())))", "(()()(()()()))", "(()()(()())())", "(()()(()()))()", "(()()(())(()))", "(()()(())()())", "(()()(())())()", "(()()(()))(())", "(()()(()))()()", "(()()()((())))", "(()()()(()()))", "(()()()(())())", "(()()()(()))()", "(()()()()(()))", "(()()()()()())", "(()()()()())()", "(()()()())(())", "(()()()())()()", "(()()())((()))", "(()()())(()())", "(()()())(())()", "(()()())()(())", "(()()())()()()", "(()())(((())))", "(()())((()()))", "(()())((())())", "(()())((()))()", "(()())(()(()))", "(()())(()()())", "(()())(()())()", "(()())(())(())", "(()())(())()()", "(()())()((()))", "(()())()(()())", "(()())()(())()", "(()())()()(())", "(()())()()()()", "(())((((()))))", "(())(((()())))", "(())(((())()))", "(())(((()))())", "(())(((())))()", "(())((()(())))", "(())((()()()))", "(())((()())())", "(())((()()))()", "(())((())(()))", "(())((())()())", "(())((())())()", "(())((()))(())", "(())((()))()()", "(())(()((())))", "(())(()(()()))", "(())(()(())())", "(())(()(()))()", "(())(()()(()))", "(())(()()()())", "(())(()()())()", "(())(()())(())", "(())(()())()()", "(())(())((()))", "(())(())(()())", "(())(())(())()", "(())(())()(())", "(())(())()()()", "(())()(((())))", "(())()((()()))", "(())()((())())", "(())()((()))()", "(())()(()(()))", "(())()(()()())", "(())()(()())()", "(())()(())(())", "(())()(())()()", "(())()()((()))", "(())()()(()())", "(())()()(())()", "(())()()()(())", "(())()()()()()", "()(((((())))))", "()((((()()))))", "()((((())())))", "()((((()))()))", "()((((())))())", "()((((()))))()", "()(((()(()))))", "()(((()()())))", "()(((()())()))", "()(((()()))())", "()(((()())))()", "()(((())(())))", "()(((())()()))", "()(((())())())", "()(((())()))()", "()(((()))(()))", "()(((()))()())", "()(((()))())()", "()(((())))(())", "()(((())))()()", "()((()((()))))", "()((()(()())))", "()((()(())()))", "()((()(()))())", "()((()(())))()", "()((()()(())))", "()((()()()()))", "()((()()())())", "()((()()()))()", "()((()())(()))", "()((()())()())", "()((()())())()", "()((()()))(())", "()((()()))()()", "()((())((())))", "()((())(()()))", "()((())(())())", "()((())(()))()", "()((())()(()))", "()((())()()())", "()((())()())()", "()((())())(())", "()((())())()()", "()((()))((()))", "()((()))(()())", "()((()))(())()", "()((()))()(())", "()((()))()()()", "()(()(((()))))", "()(()((()())))", "()(()((())()))", "()(()((()))())", "()(()((())))()", "()(()(()(())))", "()(()(()()()))", "()(()(()())())", "()(()(()()))()", "()(()(())(()))", "()(()(())()())", "()(()(())())()", "()(()(()))(())", "()(()(()))()()", "()(()()((())))", "()(()()(()()))", "()(()()(())())", "()(()()(()))()", "()(()()()(()))", "()(()()()()())", "()(()()()())()", "()(()()())(())", "()(()()())()()", "()(()())((()))", "()(()())(()())", "()(()())(())()", "()(()())()(())", "()(()())()()()", "()(())(((())))", "()(())((()()))", "()(())((())())", "()(())((()))()", "()(())(()(()))", "()(())(()()())", "()(())(()())()", "()(())(())(())", "()(())(())()()", "()(())()((()))", "()(())()(()())", "()(())()(())()", "()(())()()(())", "()(())()()()()", "()()((((()))))", "()()(((()())))", "()()(((())()))", "()()(((()))())", "()()(((())))()", "()()((()(())))", "()()((()()()))", "()()((()())())", "()()((()()))()", "()()((())(()))", "()()((())()())", "()()((())())()", "()()((()))(())", "()()((()))()()", "()()(()((())))", "()()(()(()()))", "()()(()(())())", "()()(()(()))()", "()()(()()(()))", "()()(()()()())", "()()(()()())()", "()()(()())(())", "()()(()())()()", "()()(())((()))", "()()(())(()())", "()()(())(())()", "()()(())()(())", "()()(())()()()", "()()()(((())))", "()()()((()()))", "()()()((())())", "()()()((()))()", "()()()(()(()))", "()()()(()()())", "()()()(()())()", "()()()(())(())", "()()()(())()()", "()()()()((()))", "()()()()(()())", "()()()()(())()", "()()()()()(())", "()()()()()()()" };
// string[] array = new string[] { "((((((()()))))))","((((((())())))))","((((((()))()))))","((((((())))())))","((((((()))))()))","((((((())))))())","((((((()))))))()","(((((()(()))))))","(((((()()())))))","(((((()())()))))","(((((()()))())))","(((((()())))()))","(((((()()))))())","(((((()())))))()","(((((())(())))))","(((((())()()))))","(((((())())())))","(((((())()))()))","(((((())())))())","(((((())()))))()","(((((()))(()))))","(((((()))()())))","(((((()))())()))","(((((()))()))())","(((((()))())))()","(((((())))(())))","(((((())))()()))","(((((())))())())","(((((())))()))()","(((((()))))(()))","(((((()))))()())","(((((()))))())()","(((((())))))(())","(((((())))))()()","((((()((()))))))","((((()(()())))))","((((()(())()))))","((((()(()))())))","((((()(())))()))","((((()(()))))())","((((()(())))))()","((((()()(())))))","((((()()()()))))","((((()()())())))","((((()()()))()))","((((()()())))())","((((()()()))))()","((((()())(()))))","((((()())()())))","((((()())())()))","((((()())()))())","((((()())())))()","((((()()))(())))","((((()()))()()))","((((()()))())())","((((()()))()))()","((((()())))(()))","((((()())))()())","((((()())))())()","((((()()))))(())","((((()()))))()()","((((())((())))))","((((())(()()))))","((((())(())())))","((((())(()))()))","((((())(())))())","((((())(()))))()","((((())()(()))))","((((())()()())))","((((())()())()))","((((())()()))())","((((())()())))()","((((())())(())))","((((())())()()))","((((())())())())","((((())())()))()","((((())()))(()))","((((())()))()())","((((())()))())()","((((())())))(())","((((())())))()()","((((()))((()))))","((((()))(()())))","((((()))(())()))","((((()))(()))())","((((()))(())))()","((((()))()(())))","((((()))()()()))","((((()))()())())","((((()))()()))()","((((()))())(()))","((((()))())()())","((((()))())())()","((((()))()))(())","((((()))()))()()","((((())))((())))","((((())))(()()))","((((())))(())())","((((())))(()))()","((((())))()(()))","((((())))()()())","((((())))()())()","((((())))())(())","((((())))())()()","((((()))))((()))","((((()))))(()())","((((()))))(())()","((((()))))()(())","((((()))))()()()","(((()(((()))))))","(((()((()())))))","(((()((())()))))","(((()((()))())))","(((()((())))()))","(((()((()))))())","(((()((())))))()","(((()(()(())))))","(((()(()()()))))","(((()(()())())))","(((()(()()))()))","(((()(()())))())","(((()(()()))))()","(((()(())(()))))","(((()(())()())))","(((()(())())()))","(((()(())()))())","(((()(())())))()","(((()(()))(())))","(((()(()))()()))","(((()(()))())())","(((()(()))()))()","(((()(())))(()))","(((()(())))()())","(((()(())))())()","(((()(()))))(())","(((()(()))))()()","(((()()((())))))","(((()()(()()))))","(((()()(())())))","(((()()(()))()))","(((()()(())))())","(((()()(()))))()","(((()()()(()))))","(((()()()()())))","(((()()()())()))","(((()()()()))())","(((()()()())))()","(((()()())(())))","(((()()())()()))","(((()()())())())","(((()()())()))()","(((()()()))(()))","(((()()()))()())","(((()()()))())()","(((()()())))(())","(((()()())))()()","(((()())((()))))","(((()())(()())))","(((()())(())()))","(((()())(()))())","(((()())(())))()","(((()())()(())))","(((()())()()()))","(((()())()())())","(((()())()()))()","(((()())())(()))","(((()())())()())","(((()())())())()","(((()())()))(())","(((()())()))()()","(((()()))((())))","(((()()))(()()))","(((()()))(())())","(((()()))(()))()","(((()()))()(()))","(((()()))()()())","(((()()))()())()","(((()()))())(())","(((()()))())()()","(((()())))((()))","(((()())))(()())","(((()())))(())()","(((()())))()(())","(((()())))()()()","(((())(((())))))","(((())((()()))))","(((())((())())))","(((())((()))()))","(((())((())))())","(((())((()))))()","(((())(()(()))))","(((())(()()())))","(((())(()())()))","(((())(()()))())","(((())(()())))()","(((())(())(())))","(((())(())()()))","(((())(())())())","(((())(())()))()","(((())(()))(()))","(((())(()))()())","(((())(()))())()","(((())(())))(())","(((())(())))()()","(((())()((()))))","(((())()(()())))","(((())()(())()))","(((())()(()))())","(((())()(())))()","(((())()()(())))","(((())()()()()))","(((())()()())())","(((())()()()))()","(((())()())(()))","(((())()())()())","(((())()())())()","(((())()()))(())","(((())()()))()()","(((())())((())))","(((())())(()()))","(((())())(())())","(((())())(()))()","(((())())()(()))","(((())())()()())","(((())())()())()","(((())())())(())","(((())())())()()","(((())()))((()))","(((())()))(()())","(((())()))(())()","(((())()))()(())","(((())()))()()()","(((()))(((()))))","(((()))((()())))","(((()))((())()))","(((()))((()))())","(((()))((())))()","(((()))(()(())))","(((()))(()()()))","(((()))(()())())","(((()))(()()))()","(((()))(())(()))","(((()))(())()())","(((()))(())())()","(((()))(()))(())","(((()))(()))()()","(((()))()((())))","(((()))()(()()))","(((()))()(())())","(((()))()(()))()","(((()))()()(()))","(((()))()()()())","(((()))()()())()","(((()))()())(())","(((()))()())()()","(((()))())((()))","(((()))())(()())","(((()))())(())()","(((()))())()(())","(((()))())()()()","(((())))(((())))","(((())))((()()))","(((())))((())())","(((())))((()))()","(((())))(()(()))","(((())))(()()())","(((())))(()())()","(((())))(())(())","(((())))(())()()","(((())))()((()))","(((())))()(()())","(((())))()(())()","(((())))()()(())","(((())))()()()()","((()((((()))))))","((()(((()())))))","((()(((())()))))","((()(((()))())))","((()(((())))()))","((()(((()))))())","((()(((())))))()","((()((()(())))))","((()((()()()))))","((()((()())())))","((()((()()))()))","((()((()())))())","((()((()()))))()","((()((())(()))))","((()((())()())))","((()((())())()))","((()((())()))())","((()((())())))()","((()((()))(())))","((()((()))()()))","((()((()))())())","((()((()))()))()","((()((())))(()))","((()((())))()())","((()((())))())()","((()((()))))(())","((()((()))))()()","((()(()((())))))","((()(()(()()))))","((()(()(())())))","((()(()(()))()))","((()(()(())))())","((()(()(()))))()","((()(()()(()))))","((()(()()()())))","((()(()()())()))","((()(()()()))())","((()(()()())))()","((()(()())(())))","((()(()())()()))","((()(()())())())","((()(()())()))()","((()(()()))(()))","((()(()()))()())","((()(()()))())()","((()(()())))(())","((()(()())))()()","((()(())((()))))","((()(())(()())))","((()(())(())()))","((()(())(()))())","((()(())(())))()","((()(())()(())))","((()(())()()()))","((()(())()())())","((()(())()()))()","((()(())())(()))","((()(())())()())","((()(())())())()","((()(())()))(())","((()(())()))()()","((()(()))((())))","((()(()))(()()))","((()(()))(())())","((()(()))(()))()","((()(()))()(()))","((()(()))()()())","((()(()))()())()","((()(()))())(())","((()(()))())()()","((()(())))((()))","((()(())))(()())","((()(())))(())()","((()(())))()(())","((()(())))()()()","((()()(((())))))","((()()((()()))))","((()()((())())))","((()()((()))()))","((()()((())))())","((()()((()))))()","((()()(()(()))))","((()()(()()())))","((()()(()())()))","((()()(()()))())","((()()(()())))()","((()()(())(())))","((()()(())()()))","((()()(())())())","((()()(())()))()","((()()(()))(()))","((()()(()))()())","((()()(()))())()","((()()(())))(())","((()()(())))()()","((()()()((()))))","((()()()(()())))","((()()()(())()))","((()()()(()))())","((()()()(())))()","((()()()()(())))","((()()()()()()))","((()()()()())())","((()()()()()))()","((()()()())(()))","((()()()())()())","((()()()())())()","((()()()()))(())","((()()()()))()()","((()()())((())))","((()()())(()()))","((()()())(())())","((()()())(()))()","((()()())()(()))","((()()())()()())","((()()())()())()","((()()())())(())","((()()())())()()","((()()()))((()))","((()()()))(()())","((()()()))(())()","((()()()))()(())","((()()()))()()()","((()())(((()))))","((()())((()())))","((()())((())()))","((()())((()))())","((()())((())))()","((()())(()(())))","((()())(()()()))","((()())(()())())","((()())(()()))()","((()())(())(()))","((()())(())()())","((()())(())())()","((()())(()))(())","((()())(()))()()","((()())()((())))","((()())()(()()))","((()())()(())())","((()())()(()))()","((()())()()(()))","((()())()()()())","((()())()()())()","((()())()())(())","((()())()())()()","((()())())((()))","((()())())(()())","((()())())(())()","((()())())()(())","((()())())()()()","((()()))(((())))","((()()))((()()))","((()()))((())())","((()()))((()))()","((()()))(()(()))","((()()))(()()())","((()()))(()())()","((()()))(())(())","((()()))(())()()","((()()))()((()))","((()()))()(()())","((()()))()(())()","((()()))()()(())","((()()))()()()()","((())((((())))))","((())(((()()))))","((())(((())())))","((())(((()))()))","((())(((())))())","((())(((()))))()","((())((()(()))))","((())((()()())))","((())((()())()))","((())((()()))())","((())((()())))()","((())((())(())))","((())((())()()))","((())((())())())","((())((())()))()","((())((()))(()))","((())((()))()())","((())((()))())()","((())((())))(())","((())((())))()()","((())(()((()))))","((())(()(()())))","((())(()(())()))","((())(()(()))())","((())(()(())))()","((())(()()(())))","((())(()()()()))","((())(()()())())","((())(()()()))()","((())(()())(()))","((())(()())()())","((())(()())())()","((())(()()))(())","((())(()()))()()","((())(())((())))","((())(())(()()))","((())(())(())())","((())(())(()))()","((())(())()(()))","((())(())()()())","((())(())()())()","((())(())())(())","((())(())())()()","((())(()))((()))","((())(()))(()())","((())(()))(())()","((())(()))()(())","((())(()))()()()","((())()(((()))))","((())()((()())))","((())()((())()))","((())()((()))())","((())()((())))()","((())()(()(())))","((())()(()()()))","((())()(()())())","((())()(()()))()","((())()(())(()))","((())()(())()())","((())()(())())()","((())()(()))(())","((())()(()))()()","((())()()((())))","((())()()(()()))","((())()()(())())","((())()()(()))()","((())()()()(()))","((())()()()()())","((())()()()())()","((())()()())(())","((())()()())()()","((())()())((()))","((())()())(()())","((())()())(())()","((())()())()(())","((())()())()()()","((())())(((())))","((())())((()()))","((())())((())())","((())())((()))()","((())())(()(()))","((())())(()()())","((())())(()())()","((())())(())(())","((())())(())()()","((())())()((()))","((())())()(()())","((())())()(())()","((())())()()(())","((())())()()()()","((()))((((()))))","((()))(((()())))","((()))(((())()))","((()))(((()))())","((()))(((())))()","((()))((()(())))","((()))((()()()))","((()))((()())())","((()))((()()))()","((()))((())(()))","((()))((())()())","((()))((())())()","((()))((()))(())","((()))((()))()()","((()))(()((())))","((()))(()(()()))","((()))(()(())())","((()))(()(()))()","((()))(()()(()))","((()))(()()()())","((()))(()()())()","((()))(()())(())","((()))(()())()()","((()))(())((()))","((()))(())(()())","((()))(())(())()","((()))(())()(())","((()))(())()()()","((()))()(((())))","((()))()((()()))","((()))()((())())","((()))()((()))()","((()))()(()(()))","((()))()(()()())","((()))()(()())()","((()))()(())(())","((()))()(())()()","((()))()()((()))","((()))()()(()())","((()))()()(())()","((()))()()()(())","((()))()()()()()","(()(((((()))))))","(()((((()())))))","(()((((())()))))","(()((((()))())))","(()((((())))()))","(()((((()))))())","(()((((())))))()","(()(((()(())))))","(()(((()()()))))","(()(((()())())))","(()(((()()))()))","(()(((()())))())","(()(((()()))))()","(()(((())(()))))","(()(((())()())))","(()(((())())()))","(()(((())()))())","(()(((())())))()","(()(((()))(())))","(()(((()))()()))","(()(((()))())())","(()(((()))()))()","(()(((())))(()))","(()(((())))()())","(()(((())))())()","(()(((()))))(())","(()(((()))))()()","(()((()((())))))","(()((()(()()))))","(()((()(())())))","(()((()(()))()))","(()((()(())))())","(()((()(()))))()","(()((()()(()))))","(()((()()()())))","(()((()()())()))","(()((()()()))())","(()((()()())))()","(()((()())(())))","(()((()())()()))","(()((()())())())","(()((()())()))()","(()((()()))(()))","(()((()()))()())","(()((()()))())()","(()((()())))(())","(()((()())))()()","(()((())((()))))","(()((())(()())))","(()((())(())()))","(()((())(()))())","(()((())(())))()","(()((())()(())))","(()((())()()()))","(()((())()())())","(()((())()()))()","(()((())())(()))","(()((())())()())","(()((())())())()","(()((())()))(())","(()((())()))()()","(()((()))((())))","(()((()))(()()))","(()((()))(())())","(()((()))(()))()","(()((()))()(()))","(()((()))()()())","(()((()))()())()","(()((()))())(())","(()((()))())()()","(()((())))((()))","(()((())))(()())","(()((())))(())()","(()((())))()(())","(()((())))()()()","(()(()(((())))))","(()(()((()()))))","(()(()((())())))","(()(()((()))()))","(()(()((())))())","(()(()((()))))()","(()(()(()(()))))","(()(()(()()())))","(()(()(()())()))","(()(()(()()))())","(()(()(()())))()","(()(()(())(())))","(()(()(())()()))","(()(()(())())())","(()(()(())()))()","(()(()(()))(()))","(()(()(()))()())","(()(()(()))())()","(()(()(())))(())","(()(()(())))()()","(()(()()((()))))","(()(()()(()())))","(()(()()(())()))","(()(()()(()))())","(()(()()(())))()","(()(()()()(())))","(()(()()()()()))","(()(()()()())())","(()(()()()()))()","(()(()()())(()))","(()(()()())()())","(()(()()())())()","(()(()()()))(())","(()(()()()))()()","(()(()())((())))","(()(()())(()()))","(()(()())(())())","(()(()())(()))()","(()(()())()(()))","(()(()())()()())","(()(()())()())()","(()(()())())(())","(()(()())())()()","(()(()()))((()))","(()(()()))(()())","(()(()()))(())()","(()(()()))()(())","(()(()()))()()()","(()(())(((()))))","(()(())((()())))","(()(())((())()))","(()(())((()))())","(()(())((())))()","(()(())(()(())))","(()(())(()()()))","(()(())(()())())","(()(())(()()))()","(()(())(())(()))","(()(())(())()())","(()(())(())())()","(()(())(()))(())","(()(())(()))()()","(()(())()((())))","(()(())()(()()))","(()(())()(())())","(()(())()(()))()","(()(())()()(()))","(()(())()()()())","(()(())()()())()","(()(())()())(())","(()(())()())()()","(()(())())((()))","(()(())())(()())","(()(())())(())()","(()(())())()(())","(()(())())()()()","(()(()))(((())))","(()(()))((()()))","(()(()))((())())","(()(()))((()))()","(()(()))(()(()))","(()(()))(()()())","(()(()))(()())()","(()(()))(())(())","(()(()))(())()()","(()(()))()((()))","(()(()))()(()())","(()(()))()(())()","(()(()))()()(())","(()(()))()()()()","(()()((((())))))","(()()(((()()))))","(()()(((())())))","(()()(((()))()))","(()()(((())))())","(()()(((()))))()","(()()((()(()))))","(()()((()()())))","(()()((()())()))","(()()((()()))())","(()()((()())))()","(()()((())(())))","(()()((())()()))","(()()((())())())","(()()((())()))()","(()()((()))(()))","(()()((()))()())","(()()((()))())()","(()()((())))(())","(()()((())))()()","(()()(()((()))))","(()()(()(()())))","(()()(()(())()))","(()()(()(()))())","(()()(()(())))()","(()()(()()(())))","(()()(()()()()))","(()()(()()())())","(()()(()()()))()","(()()(()())(()))","(()()(()())()())","(()()(()())())()","(()()(()()))(())","(()()(()()))()()","(()()(())((())))","(()()(())(()()))","(()()(())(())())","(()()(())(()))()","(()()(())()(()))","(()()(())()()())","(()()(())()())()","(()()(())())(())","(()()(())())()()","(()()(()))((()))","(()()(()))(()())","(()()(()))(())()","(()()(()))()(())","(()()(()))()()()","(()()()(((()))))","(()()()((()())))","(()()()((())()))","(()()()((()))())","(()()()((())))()","(()()()(()(())))","(()()()(()()()))","(()()()(()())())","(()()()(()()))()","(()()()(())(()))","(()()()(())()())","(()()()(())())()","(()()()(()))(())","(()()()(()))()()","(()()()()((())))","(()()()()(()()))","(()()()()(())())","(()()()()(()))()","(()()()()()(()))","(()()()()()()())","(()()()()()())()","(()()()()())(())","(()()()()())()()","(()()()())((()))","(()()()())(()())","(()()()())(())()","(()()()())()(())","(()()()())()()()","(()()())(((())))","(()()())((()()))","(()()())((())())","(()()())((()))()","(()()())(()(()))","(()()())(()()())","(()()())(()())()","(()()())(())(())","(()()())(())()()","(()()())()((()))","(()()())()(()())","(()()())()(())()","(()()())()()(())","(()()())()()()()","(()())((((()))))","(()())(((()())))","(()())(((())()))","(()())(((()))())","(()())(((())))()","(()())((()(())))","(()())((()()()))","(()())((()())())","(()())((()()))()","(()())((())(()))","(()())((())()())","(()())((())())()","(()())((()))(())","(()())((()))()()","(()())(()((())))","(()())(()(()()))","(()())(()(())())","(()())(()(()))()","(()())(()()(()))","(()())(()()()())","(()())(()()())()","(()())(()())(())","(()())(()())()()","(()())(())((()))","(()())(())(()())","(()())(())(())()","(()())(())()(())","(()())(())()()()","(()())()(((())))","(()())()((()()))","(()())()((())())","(()())()((()))()","(()())()(()(()))","(()())()(()()())","(()())()(()())()","(()())()(())(())","(()())()(())()()","(()())()()((()))","(()())()()(()())","(()())()()(())()","(()())()()()(())","(()())()()()()()","(())(((((())))))","(())((((()()))))","(())((((())())))","(())((((()))()))","(())((((())))())","(())((((()))))()","(())(((()(()))))","(())(((()()())))","(())(((()())()))","(())(((()()))())","(())(((()())))()","(())(((())(())))","(())(((())()()))","(())(((())())())","(())(((())()))()","(())(((()))(()))","(())(((()))()())","(())(((()))())()","(())(((())))(())","(())(((())))()()","(())((()((()))))","(())((()(()())))","(())((()(())()))","(())((()(()))())","(())((()(())))()","(())((()()(())))","(())((()()()()))","(())((()()())())","(())((()()()))()","(())((()())(()))","(())((()())()())","(())((()())())()","(())((()()))(())","(())((()()))()()","(())((())((())))","(())((())(()()))","(())((())(())())","(())((())(()))()","(())((())()(()))","(())((())()()())","(())((())()())()","(())((())())(())","(())((())())()()","(())((()))((()))","(())((()))(()())","(())((()))(())()","(())((()))()(())","(())((()))()()()","(())(()(((()))))","(())(()((()())))","(())(()((())()))","(())(()((()))())","(())(()((())))()","(())(()(()(())))","(())(()(()()()))","(())(()(()())())","(())(()(()()))()","(())(()(())(()))","(())(()(())()())","(())(()(())())()","(())(()(()))(())","(())(()(()))()()","(())(()()((())))","(())(()()(()()))","(())(()()(())())","(())(()()(()))()","(())(()()()(()))","(())(()()()()())","(())(()()()())()","(())(()()())(())","(())(()()())()()","(())(()())((()))","(())(()())(()())","(())(()())(())()","(())(()())()(())","(())(()())()()()","(())(())(((())))","(())(())((()()))","(())(())((())())","(())(())((()))()","(())(())(()(()))","(())(())(()()())","(())(())(()())()","(())(())(())(())","(())(())(())()()","(())(())()((()))","(())(())()(()())","(())(())()(())()","(())(())()()(())","(())(())()()()()","(())()((((()))))","(())()(((()())))","(())()(((())()))","(())()(((()))())","(())()(((())))()","(())()((()(())))","(())()((()()()))","(())()((()())())","(())()((()()))()","(())()((())(()))","(())()((())()())","(())()((())())()","(())()((()))(())","(())()((()))()()","(())()(()((())))","(())()(()(()()))","(())()(()(())())","(())()(()(()))()","(())()(()()(()))","(())()(()()()())","(())()(()()())()","(())()(()())(())","(())()(()())()()","(())()(())((()))","(())()(())(()())","(())()(())(())()","(())()(())()(())","(())()(())()()()","(())()()(((())))","(())()()((()()))","(())()()((())())","(())()()((()))()","(())()()(()(()))","(())()()(()()())","(())()()(()())()","(())()()(())(())","(())()()(())()()","(())()()()((()))","(())()()()(()())","(())()()()(())()","(())()()()()(())","(())()()()()()()","()((((((()))))))","()(((((()())))))","()(((((())()))))","()(((((()))())))","()(((((())))()))","()(((((()))))())","()(((((())))))()","()((((()(())))))","()((((()()()))))","()((((()())())))","()((((()()))()))","()((((()())))())","()((((()()))))()","()((((())(()))))","()((((())()())))","()((((())())()))","()((((())()))())","()((((())())))()","()((((()))(())))","()((((()))()()))","()((((()))())())","()((((()))()))()","()((((())))(()))","()((((())))()())","()((((())))())()","()((((()))))(())","()((((()))))()()","()(((()((())))))","()(((()(()()))))","()(((()(())())))","()(((()(()))()))","()(((()(())))())","()(((()(()))))()","()(((()()(()))))","()(((()()()())))","()(((()()())()))","()(((()()()))())","()(((()()())))()","()(((()())(())))","()(((()())()()))","()(((()())())())","()(((()())()))()","()(((()()))(()))","()(((()()))()())","()(((()()))())()","()(((()())))(())","()(((()())))()()","()(((())((()))))","()(((())(()())))","()(((())(())()))","()(((())(()))())","()(((())(())))()","()(((())()(())))","()(((())()()()))","()(((())()())())","()(((())()()))()","()(((())())(()))","()(((())())()())","()(((())())())()","()(((())()))(())","()(((())()))()()","()(((()))((())))","()(((()))(()()))","()(((()))(())())","()(((()))(()))()","()(((()))()(()))","()(((()))()()())","()(((()))()())()","()(((()))())(())","()(((()))())()()","()(((())))((()))","()(((())))(()())","()(((())))(())()","()(((())))()(())","()(((())))()()()","()((()(((())))))","()((()((()()))))","()((()((())())))","()((()((()))()))","()((()((())))())","()((()((()))))()","()((()(()(()))))","()((()(()()())))","()((()(()())()))","()((()(()()))())","()((()(()())))()","()((()(())(())))","()((()(())()()))","()((()(())())())","()((()(())()))()","()((()(()))(()))","()((()(()))()())","()((()(()))())()","()((()(())))(())","()((()(())))()()","()((()()((()))))","()((()()(()())))","()((()()(())()))","()((()()(()))())","()((()()(())))()","()((()()()(())))","()((()()()()()))","()((()()()())())","()((()()()()))()","()((()()())(()))","()((()()())()())","()((()()())())()","()((()()()))(())","()((()()()))()()","()((()())((())))","()((()())(()()))","()((()())(())())","()((()())(()))()","()((()())()(()))","()((()())()()())","()((()())()())()","()((()())())(())","()((()())())()()","()((()()))((()))","()((()()))(()())","()((()()))(())()","()((()()))()(())","()((()()))()()()","()((())(((()))))","()((())((()())))","()((())((())()))","()((())((()))())","()((())((())))()","()((())(()(())))","()((())(()()()))","()((())(()())())","()((())(()()))()","()((())(())(()))","()((())(())()())","()((())(())())()","()((())(()))(())","()((())(()))()()","()((())()((())))","()((())()(()()))","()((())()(())())","()((())()(()))()","()((())()()(()))","()((())()()()())","()((())()()())()","()((())()())(())","()((())()())()()","()((())())((()))","()((())())(()())","()((())())(())()","()((())())()(())","()((())())()()()","()((()))(((())))","()((()))((()()))","()((()))((())())","()((()))((()))()","()((()))(()(()))","()((()))(()()())","()((()))(()())()","()((()))(())(())","()((()))(())()()","()((()))()((()))","()((()))()(()())","()((()))()(())()","()((()))()()(())","()((()))()()()()","()(()((((())))))","()(()(((()()))))","()(()(((())())))","()(()(((()))()))","()(()(((())))())","()(()(((()))))()","()(()((()(()))))","()(()((()()())))","()(()((()())()))","()(()((()()))())","()(()((()())))()","()(()((())(())))","()(()((())()()))","()(()((())())())","()(()((())()))()","()(()((()))(()))","()(()((()))()())","()(()((()))())()","()(()((())))(())","()(()((())))()()","()(()(()((()))))","()(()(()(()())))","()(()(()(())()))","()(()(()(()))())","()(()(()(())))()","()(()(()()(())))","()(()(()()()()))","()(()(()()())())","()(()(()()()))()","()(()(()())(()))","()(()(()())()())","()(()(()())())()","()(()(()()))(())","()(()(()()))()()","()(()(())((())))","()(()(())(()()))","()(()(())(())())","()(()(())(()))()","()(()(())()(()))","()(()(())()()())","()(()(())()())()","()(()(())())(())","()(()(())())()()","()(()(()))((()))","()(()(()))(()())","()(()(()))(())()","()(()(()))()(())","()(()(()))()()()","()(()()(((()))))","()(()()((()())))","()(()()((())()))","()(()()((()))())","()(()()((())))()","()(()()(()(())))","()(()()(()()()))","()(()()(()())())","()(()()(()()))()","()(()()(())(()))","()(()()(())()())","()(()()(())())()","()(()()(()))(())","()(()()(()))()()","()(()()()((())))","()(()()()(()()))","()(()()()(())())","()(()()()(()))()","()(()()()()(()))","()(()()()()()())","()(()()()()())()","()(()()()())(())","()(()()()())()()","()(()()())((()))","()(()()())(()())","()(()()())(())()","()(()()())()(())","()(()()())()()()","()(()())(((())))","()(()())((()()))","()(()())((())())","()(()())((()))()","()(()())(()(()))","()(()())(()()())","()(()())(()())()","()(()())(())(())","()(()())(())()()","()(()())()((()))","()(()())()(()())","()(()())()(())()","()(()())()()(())","()(()())()()()()","()(())((((()))))","()(())(((()())))","()(())(((())()))","()(())(((()))())","()(())(((())))()","()(())((()(())))","()(())((()()()))","()(())((()())())","()(())((()()))()","()(())((())(()))","()(())((())()())","()(())((())())()","()(())((()))(())","()(())((()))()()","()(())(()((())))","()(())(()(()()))","()(())(()(())())","()(())(()(()))()","()(())(()()(()))","()(())(()()()())","()(())(()()())()","()(())(()())(())","()(())(()())()()","()(())(())((()))","()(())(())(()())","()(())(())(())()","()(())(())()(())","()(())(())()()()","()(())()(((())))","()(())()((()()))","()(())()((())())","()(())()((()))()","()(())()(()(()))","()(())()(()()())","()(())()(()())()","()(())()(())(())","()(())()(())()()","()(())()()((()))","()(())()()(()())","()(())()()(())()","()(())()()()(())","()(())()()()()()","()()(((((())))))","()()((((()()))))","()()((((())())))","()()((((()))()))","()()((((())))())","()()((((()))))()","()()(((()(()))))","()()(((()()())))","()()(((()())()))","()()(((()()))())","()()(((()())))()","()()(((())(())))","()()(((())()()))","()()(((())())())","()()(((())()))()","()()(((()))(()))","()()(((()))()())","()()(((()))())()","()()(((())))(())","()()(((())))()()","()()((()((()))))","()()((()(()())))","()()((()(())()))","()()((()(()))())","()()((()(())))()","()()((()()(())))","()()((()()()()))","()()((()()())())","()()((()()()))()","()()((()())(()))","()()((()())()())","()()((()())())()","()()((()()))(())","()()((()()))()()","()()((())((())))","()()((())(()()))","()()((())(())())","()()((())(()))()","()()((())()(()))","()()((())()()())","()()((())()())()","()()((())())(())","()()((())())()()","()()((()))((()))","()()((()))(()())","()()((()))(())()","()()((()))()(())","()()((()))()()()","()()(()(((()))))","()()(()((()())))","()()(()((())()))","()()(()((()))())","()()(()((())))()","()()(()(()(())))","()()(()(()()()))","()()(()(()())())","()()(()(()()))()","()()(()(())(()))","()()(()(())()())","()()(()(())())()","()()(()(()))(())","()()(()(()))()()","()()(()()((())))","()()(()()(()()))","()()(()()(())())","()()(()()(()))()","()()(()()()(()))","()()(()()()()())","()()(()()()())()","()()(()()())(())","()()(()()())()()","()()(()())((()))","()()(()())(()())","()()(()())(())()","()()(()())()(())","()()(()())()()()","()()(())(((())))","()()(())((()()))","()()(())((())())","()()(())((()))()","()()(())(()(()))","()()(())(()()())","()()(())(()())()","()()(())(())(())","()()(())(())()()","()()(())()((()))","()()(())()(()())","()()(())()(())()","()()(())()()(())","()()(())()()()()","()()()((((()))))","()()()(((()())))","()()()(((())()))","()()()(((()))())","()()()(((())))()","()()()((()(())))","()()()((()()()))","()()()((()())())","()()()((()()))()","()()()((())(()))","()()()((())()())","()()()((())())()","()()()((()))(())","()()()((()))()()","()()()(()((())))","()()()(()(()()))","()()()(()(())())","()()()(()(()))()","()()()(()()(()))","()()()(()()()())","()()()(()()())()","()()()(()())(())","()()()(()())()()","()()()(())((()))","()()()(())(()())","()()()(())(())()","()()()(())()(())","()()()(())()()()","()()()()(((())))","()()()()((()()))","()()()()((())())","()()()()((()))()","()()()()(()(()))","()()()()(()()())","()()()()(()())()","()()()()(())(())","()()()()(())()()","()()()()()((()))","()()()()()(()())","()()()()()(())()","()()()()()()(())","()()()()()()()()"};
StringBuilder stringBuilder = new StringBuilder();
string result;
void testisValid() {
var primero = isValid("((((())()())))");
var primero2 = isValid("((()");
var primero3 = isValid("((())");
var primero4 = isValid("((()))))");
var primero5 = isValid("((()()()())");
var primer6valid = isValid("(()((())()()))()");
}
public List<List<int>> LlenarDerecha(int izquierda, int intermedio)
{
List < List<int> > indices= new List<List<int>>();
int hasta = derechaBASE - intermedio;
for (int x = 1; x <= hasta; x++)
{
var linea = new List<int>();
linea.Add(izquierda);
linea.Add(intermedio);
var intermediolocal = derechaBASE;
for (int y = 0; y < x; y++)
{
linea.Add(--intermediolocal);
}
indices.Add(linea);
}
return indices;
}
public List<structure> fillit(int izquierda, int intermedio) {
List<structure> structure = new List<structure>();
int hasta = intermedio - izquierda;
int x = intermedio;
for (; x > izquierda; x--)
{
if (x < derechaBASE)
{
var derecha = new List<int>();
derecha.Add(izquierda);
derecha.Add(x);
//structure.indices.Add(derecha);
structure.Add(new Problems.structure(derecha));
int veremos= izquierdaBASE- x;
if (veremos >= 2)
{
derecha = new List<int>(derecha);
derecha.Add(x + 1);
structure.Add(new Problems.structure(derecha));
}
//int y = derechaBASE - x-1;
//var derechaInner = new List<int>(derecha);
//bool iffor = false;
////for (int i=1; i <= y; i++)
////{
//// iffor=true;
//// int nuevonumero = x + i;
//// derecha.Add(nuevonumero);
//// derechaInner.Add(nuevonumero);
////}
////if(iffor)
// indices.Add(derecha);
}
}
List<List<int>> last = new List<List<int>>();
foreach (var item in structure)
{
// last.Add(item);
int i = item.indices.Last()+1;
int lastitem = item.indices.Last();
if (lastitem != izquierdaBASE)
{
var inner = new List<int>(item.indices);
// bool entro = true;
//for (; i <= derechaBASE ; i++)
//{
// entro = true;
// inner.Add(i);
//}
inner.Add(izquierdaBASE);
inner.Add(derechaBASE);
item.hijos.Add(new Problems.structure(inner));
if (item.indices.Count > 2) {
inner = new List<int>(item.indices);
// bool entro = true;
//for (; i <= derechaBASE ; i++)
//{
// entro = true;
// inner.Add(i);
//}
inner.Add(derechaBASE);
inner.Add(derechaBASE+1);
item.hijos.Add(new Problems.structure(inner));
}
// if (entro)
//inner = new List<int>(item.indices);
//inner.Add(izquierdaBASE);
//inner.Add(derechaBASE+1);
//item.hijos.Add(new Problems.structure(inner));
}
int vamos = lastitem - izquierdaBASE;
if (vamos >= 2)
{
}
}
return structure;
}
bool isValid(string parenthises)
{
if (parenthises[0] == ')') return false;
if (parenthises[parenthises.Length-1] == '(') return false;
while (string.IsNullOrEmpty(parenthises)==false)
{
if (parenthises[parenthises.Length - 1] == '(') return false;
for (int i = 0; i < parenthises.Length; i++)
{
if (parenthises[i] == ')')
{
int indexparther = i - 1;
if (indexparther == -1) return false;
var char1= parenthises[i];
var char2 = parenthises[indexparther];
if (parenthises[indexparther] == '(')
{
parenthises =new string( parenthises.Replace("()", ""));
if (parenthises.Length == 0)
{
parenthises = string.Empty;
return true;
}
break;
}
else
{ return false; }
}
}
}
if (parenthises.Length == 0)
return true;
else return false;
}
public void print()
{
string basepoint = "((((((()))))))";
int n = 13;
var array = array7;
for (int i = 0; i <= n; i++)
{
stringBuilder.Append("0,");
}
for (int i = 0; i <= n; i++)
{
stringBuilder.Append(basepoint[i]);
stringBuilder.Append(",");
}
stringBuilder.AppendLine();
foreach (var item in array)
{
for (int i = 0; i <= n; i++)
{
if (basepoint[i] == item[i])
{
stringBuilder.Append("0,");
}
else {
stringBuilder.Append($"{i},");
}
}
for (int i = 0; i <= n; i++)
{
stringBuilder.Append(item[i]);
stringBuilder.Append(",");
}
stringBuilder.Append(item);
stringBuilder.Append(",");
stringBuilder.AppendLine();
}
result= stringBuilder.ToString();
}
}
}
Editor is loading...