object Main extends App {
  val Seq(s, t)  = Range(2).map(_ => scala.io.StdIn.readLine)
  var impossible = false
  for(index <- Range(s.length)) {
    val map: Map[Char, Char] = map.Empty
    val rmap: Map[Char, Char] = map.Empty
    if(map.getOrElseUpdate(s(index) -> t) != t) impossible = true
  }
  println(n-good)
}
