corrected the printfs to match the given output