import scala.io.StdIn

object Main extends App {

  val c = Map(
    '1' -> 20063,
    '2' -> 19892,
    '3' -> 20011,
    '4' -> 19874,
    '5' -> 20199,
    '6' -> 19898,
    '7' -> 20163,
    '8' -> 19956,
    '9' -> 19841,
    '0' -> 20104,
    '.' -> 1
  )

  def proc(pi: String): (Int, Int) = {
    val charCounts = pi.groupBy(identity).map(x => x._1 -> x._2.length)

    val wrong = charCounts.find(x => c(x._1) < x._2).get._1.asDigit
    val right = charCounts.find(x => c(x._1) > x._2).get._1.asDigit
    (wrong, right)
  }

  val pi = StdIn.readLine()

  val result: (Int, Int) = proc(pi)
  println(result._1 + " " + result._2)
}