Skip to content

Instantly share code, notes, and snippets.

@jhsu
Created January 23, 2011 06:24
Show Gist options
  • Save jhsu/791874 to your computer and use it in GitHub Desktop.
Save jhsu/791874 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
ARGV[0] ||= "aabbbcddfff"
m=0;p ARGV[0].scan(/(.)(\1+)/i).map(&:join).sort_by(&:size).reverse.map{|l|l.size>= m ? (m = l.size;l[0]) : nil}.compact.*","
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment