Solution to reddit programming challenge easy#133