gets f = %i(Red Orange Yellow Green Cyan Blue Violet).map { [_1, 0] }.to_h before, after = Array.new(2) { f.merge(gets.split.group_by { _1 }.map { [_1, _2.size] }.to_h) } puts after.filter { before[_1] != _2 }.to_a[0][0]