Mathematica, 25 bytes
Tally@#~MatchQ~{{_,2}..}&
The Tally
function returns a list of the form {{element, count}, ...}
, which is then matched against a pattern that checks whether all count
are 2.
Tally@#~MatchQ~{{_,2}..}&
The Tally
function returns a list of the form {{element, count}, ...}
, which is then matched against a pattern that checks whether all count
are 2.