Solution to reddit.com/r/dailyprogrammer challenge #178 [Easy]