← all problems

insideParentheses 🌶️🌶️

Write a method that takes one String parameter, text, and returns the part of text between the parentheses. For example, insideParentheses("f(x)") should return "x", and insideParentheses("call(a, b) now") should return "a, b".

Precondition: text contains exactly one "(" and exactly one ")", in that order.