Solution to print_reverse