Note that this code assumes that the input string contains only one pair of parentheses. If you need to extract substrings between different pairs of characters or for different inputs, you will need to modify the startIndex and endIndex variables accordingly. Also, if the input string does not contain the specified characters, the IndexOf method will return -1, so you will need to add error handling to handle this case.