Exercise 4 done not using hash