Adding solution for Problem 18!!