add problem 12 to php, python, and ruby