A programming exercise