Determine if two grammars for the same language are ambiguous I'm reading the book: Formal Syntax and Semantics of Programming Languages. I don't understand this exercise:

Consider the following two grammars, each of which generates strings of correctly balanced parentheses and brackets. Determine if either or both is ambiguous. The Greek letter ε represents an empty string.
&lt;string&gt; ::= &lt;string&gt; &lt;string&gt; | ( &lt;string&gt; ) | [ &lt;string&gt; ] | ε
&lt;string&gt; ::= ( &lt;string&gt; ) &lt;string&gt; | [ &lt;string&gt; ] &lt;string&gt; | ε
Consider this a hint.  As I write in my comment, what is the syntax tree of ()()()?  Does the first two pairs belong to the leftmost of the &lt;string&gt;&lt;string&gt;-part, or does the two latter pairs belong to the rightmost?

$$ \left(
 \overbrace{  \overbrace{ () }^\text{string} \quad
 \overbrace{ () }^\text{string}}^\text{string}
\quad \overbrace{ () }^\text{string} \right)
\text{ vs }
\left(
 \overbrace{ () }^\text{string}\quad
 \overbrace{  \overbrace{ () }^\text{string}\quad
 \overbrace{ () }^\text{string}}^\text{string} \right)
$$