#1807

Evaluate the Bracket Pairs of a String

pupil · 575 · lc medium +29 · premium · verified · 69.3% accepted · 519 likes · top 77%

Description

You are given string s with bracket pairs enclosing keys, and knowledge[i] = [keyi, valuei]. For each bracket pair replace the key with its value from knowledge, or with "?" if unknown. No nested brackets. Each key appears at most once. Return the resulting string.

Code

1
2
3