Scala: Problem 12
Scala: Problem 13