Print at k distance apart

not passing two test cases