simple run-length encoding in scala