static int Control(int x=0) { string str = "(a(b(c)d)e)"; for (int i = 0; i <= str.Length; i++) { if (str[i] =='(') x++; if (str[i] == ')') x--; } return x; } static void Main(string[] args) { int x = 0; bool flag = false; if (Control(x)==0) { flag = true; } Console.WriteLine(flag); Console.ReadLine(); }
...string str = "(a(b(cde)";...
[str.Length]
x
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)