added cpp solution to problem #17