Python 2.x
from itertools import groupby s=`len(' ')` for x in' ': print s s=''.join(i+`len(list(j))` for i,j in groupby(s)) and a version without the hacky strings
from math import * from itertools import groupby s=`int(log(e))` for x in s*int(e**pi-e): print s s=''.join(i+`len(list(j))` for i,j in groupby(s)) note that e**pi-pi is very close to 20 (19.99909997918947) but slightly smaller, so it's no good to use int with