Add #18 Python solution