Exercise 4

source of challenge: /r/dailyprogrammer