done and sample output matched, though a strange feeling bothers me.
anyway, submitted.