Skip to content

Instantly share code, notes, and snippets.

@dividedmind
Created October 15, 2013 09:59
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 dividedmind/6989334 to your computer and use it in GitHub Desktop.
Save dividedmind/6989334 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# solution of http://uva.onlinejudge.org/external/13/1339.pdf
ARGF.map {|x| x.strip.chars.group_by(&:to_s).values.map(&:length).sort }.
each_slice(2) {|a, b| puts a == b ? 'YES' : 'NO' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment