Scala solution without implicits

Unlike other Scala solutions, this one doesn't rely on implicit conversions to strings, so it is more correct.