From: Andrew Savige [mailto:ajsavige / yahoo.com.au] 
#   s = "ZBBBCZZ"
#   x = s.scan(/((.)\2*)/).map {|i| i[0]}

when it comes to string patterns like this, nothing beats regex
 
#   import itertools
#   s = "ZBBBCCZZ"
#   x = [''.join(g) for k, g in itertools.groupby(s)]
# Does anyone know if Ruby has a similar library to Python's itertools?

hmm, you seem to like this than your previous regex+map solution, why? (i ask because i prefer your first solution --not that it's ruby)

in 1.9 or the upcoming ruby, it keeps getting better and better and may look like this,

s = "ZBBBCZZ"
x = s.split('').group_by{|x| x}.entries

or possibly to

x = s.split('').group_by.entries

but unfortunately i don't have a 1.9 build here to test (grrr, shouldn't have deleted that vm).

kind regards -botp