solved exercise 14 from arrays