>_
is_valid.swift
Swift 6.2
Not run yet

+ 7 hidden

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

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