Skip to content

Instantly share code, notes, and snippets.

@hyuki
Last active November 29, 2020 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyuki/9ff4f2dfe926b31d25a2837e620fc5f4 to your computer and use it in GitHub Desktop.
Save hyuki/9ff4f2dfe926b31d25a2837e620fc5f4 to your computer and use it in GitHub Desktop.
DATA.each do |w|
h = Hash.new(0)
w.chomp.split(//).map { |c| h[c] += 1 }
if h.keys.select { |key| h[key] % 2 != 0 }.size == 0
puts w
end
end
__END__
put
here
your
word
list
and
you
will
find
ooffee
word
for
example
as
follows
agaragar
appeases
bilabial
deed
intestines
peep
poop
reappear
redder
sees
signings
teammate
@hyuki
Copy link
Author

hyuki commented Nov 29, 2020

$ ruby ooffee.rb
ooffee
agaragar
appeases
bilabial
deed
intestines
peep
poop
reappear
redder
sees
signings
teammate

@hyuki
Copy link
Author

hyuki commented Nov 29, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment