#!/usr/bin/perl -w use strict;undef $/;$_=<>;while(m+^(\d)(\1*)+) {print length($1.$2),$1;s;$1$2;;;} ######################################################## # # This works best with the numbers 1, 2, and 3. # ########################################################