Programming Challenge #173 from reddit.com/r/dailyprogrammer