[erl] Problem 6 (from work)