right output not meeting last condition. little help pls