String processing in Python(as a list)
<p>I need some advice. I need to write a program in Python that requests from the user a string <code>S</code> consisting of left
and right brackets, for instance <code>(()))(()(</code>.</p>

<p>After this, the program needs to count the number of left and the number of right brackets of the input string. For example, the string <code>(()))(()</code> contains four right brackets and four left brackets. Hint: introduce two counters initialized to zero in the beginning. Then explore the symbols of the string in a loop. For the current symbol increment the <code>left</code> counter by <code>1</code> f the symbol is <code>(</code>, otherwise, increment by <code>1</code> the <code>right</code> counter.</p>

<p>Then, I need to test whether the string is math-like.</p>

<p>Let us call a string math-like if the brackets occur like in a mathematical formula.
For instance, the strings <code>()</code>, <code>(())()</code>, <code>(()())</code> are math-like, while the strings
<code>))(())((</code> and <code>())(()</code> are not.
I need to write a program that prints <code>"YES"</code> if the input string is math-like and <code>"NO"</code>
otherwise. Hint: In particular, for each iteration of the loop, I need to check that the values of the <code>left</code> and <code>right</code> counters satisfy a particular condition.</p>

<p>I am just a beginner, so it is really confusing for me to write an implementation of this task or at least imagine how this should look.</p>

<p>I will appreciate any type of help, because I really need to solve this problem. Thank you in advance! </p>