`find()` returns `-1` if it can't find the character. You need to check for that. Or you could just use a regular expression.
– BarmarJan 10 '21 at 06:01
You should also start searching for `)` at the position of `(`. The second argument to `find()` is useful for this.
– BarmarJan 10 '21 at 06:03