It would be simpler to code this indeed, but I found the challenge interesting and I built something that seems to work:
The png should be clear enough (if you open it in a new window or download it). If you have the patience to rebuild it, I’ll be glad to answer to any question.
String.Contains and Clear List are from Archi-lab Grimshaw, Geometry Intersection is from Dynamo4MEP, All Elements of Family Type (Universal) is from Clockwork and finally, Springs.Dictionary.ByKeysValues is from Spring Nodes.