Adding solution for roblem 18