Ruby class Hash has method "invert" which make "reversal" between keys and values and delete same keys (in our case its: "1=>:a"). h = {a: 1, b: 2, c: 1} => {:a=>1, :b=>2, :c=>1} h.invert => {1=>:c, 2=>:b}
How implement custom Hash method "c_invert", which will return very first (not last) pair of duplicated key => value? Exapmle:
> h = {a: 1, b: 2, c: 1}
=> {:a=>1, :b=>2, :c=>1}
> h.c_invert
=> {1=>:a, 2=>:b}