add problem 9 to php, python and ruby