>_
is_valid.rb
Ruby 4.0
Not run yet

+ 7 hidden

Input
s = "{[()()]}"
Expected
true

Each pair closes inside the one that opened before it, and nothing is left open.