Challenge 13 in Java and Python