Updated solution to reddit problem Variable Notation