As mentioned in juathalf's answer, the definition of the "function" $f$ is that
if $x$ is any appropriate string, expression, or arrangement of symbols, then $f(x)$ is the number of symbols in $x$, with duplicates included, but not including invisible "symbols" such as the exponentiation operator in $2^2$.
But what is the most inclusive possible domain of $f$? A first attempt at answering that is to simply say that the domain of $f$ is
the set of all arrangements of symbols (including the empty arrangement, so that $f()$ is defined as $0$).
However, the problem with this is that
it results in ambiguous expressions, since the expression $f(a) + f(b)$ could mean either the length of "$a$" plus the length of "$b$" or the length of "$a) + f(b$"!
One possible solution would be to say that
an ambiguous expression involving $f$ must be accompanied by an explanation of how it is interpreted.
A more hilarious option would be to say that
the parentheses around the argument of $f$ must be much larger than any potentially confusing parentheses inside the argument, so that the second interpretation above could be written as $f \bigg (a) + f (b \bigg)$.
But I think the author's intended domain is probably
the set of all arrangements of symbols that do not include unmatched parentheses.