But that code doesn't seem to count groups of consecutive repetition just once, does it? - (which is what I thought the original poster wanted.)
chas
(Update: Actually, now that I've gone to a system where
I could try out uniq -c, I see that I misunderstood what was
desired so my code doesn't seem to do what the original poster
wanted. Your code is closer, but the output isn't the same as that of uniq -c, at least the version I used. Sorry about the confusion...)