can't pass test 14 and 17;always print extra new line