text: a string of lowercase English letters and digits that contains pairs of round brackets. Each pair holds a non-empty key; for example, in hi(name) the key is name. Brackets are never nested.
You also get a dictionary known, where known[i] = [key, value] says that key maps to value. Each key appears in known at most once.
Replace every bracket pair together with its key by the key's value. If the key is not in known, replace the brackets and the key with a single ?. Characters outside brackets stay as they are. Return the resulting string.text="dear(who)see(day)", known=[["who", "anna"], ["day", "monday"]] → 'dearannaseemonday'
(who) becomes anna, and (day) becomes monday.
text="(x)plus(y)is(x)", known=[["x", "two"]] → 'twoplus?istwo'
The key x appears twice and is replaced by two both times. The value of y is unknown, so it becomes ?.
text="nobrackets", known=[] → 'nobrackets'
text consists of lowercase English letters, digits and the brackets (, ); the brackets form non-nested pairs, each with a non-empty key insideknown are uniquetext="dear(who)see(day)", known=[["who", "anna"], ["day", "monday"]]
'dearannaseemonday'
Run checks the first 3 tests in your browser. Submit checks all 79 tests on the server, hidden ones included.