Finished DailyProgrammer Challenge from reddit #166b