import scala.collection.mutable
import scala.io.StdIn._
object Main extends App {
  val a = readLine.trim.toArray
  val b = readLine.trim.toArray

  val aZero = new MaxBit(a.length)
  val aOne = new MaxBit(a.length)
  val bZero = new MaxBit(b.length)
  val bOne = new MaxBit(b.length)
  for (i ← a.indices) {
    if (a(i) == '0') aZero.increase(i, i)
    else aOne.increase(i, i)
  }
  for (i ← b.indices) {
    if (b(i) == '0') bZero.increase(i, i)
    else bOne.increase(i, i)
  }
  val startWithZero = mutable.Queue((a.length, b.length))
  val startWithOne = mutable.Queue[(Int, Int)]()
  val minLength = Array.fill(a.length + 1){Array.fill(b.length + 1){Int.MaxValue}}
  minLength(a.length)(b.length) = 0
  val prev = Array.fill(a.length + 1){Array.fill(b.length + 1){Nil: List[Char]}}
  var result = Nil: List[Char]
  while (result.isEmpty) {
    val zeroCount = startWithZero.length
    val oneCount = startWithOne.length
    for (_ ← 0 until zeroCount) {
      val (ai, bi) = startWithZero.dequeue()
      val az = aZero(ai - 1)
      val bz = bZero(bi - 1)
      if (az >= 0 || bz >= 0){
        val aj = Math.max(az, 0)
        val bj = Math.max(bz, 0)
        if (minLength(ai)(bi) + 1 < minLength(aj)(bj)) {
          minLength(aj)(bj) = minLength(ai)(bi) + 1
          prev(aj)(bj) = '0'::prev(ai)(bi)
          startWithZero.enqueue((aj, bj))
        }
      }else if (result.isEmpty || result.head == '1'){
        result = '0'::prev(ai)(bi)
      }
      val ao = aOne(ai - 1)
      val bo = bOne(bi - 1)
      if (ao >= 0 || bo >= 0){
        val aj = Math.max(ao, 0)
        val bj = Math.max(bo, 0)
        if (minLength(ai)(bi) + 1 < minLength(aj)(bj)){
          minLength(aj)(bj) = minLength(ai)(bi) + 1
          prev(aj)(bj) = '1'::prev(ai)(bi)
          startWithOne.enqueue((aj, bj))
        }
      }else if (result.isEmpty) {
        result = '1'::prev(ai)(bi)
      }
    }
    for (_ ← 0 until oneCount) {
      val (ai, bi) = startWithOne.dequeue()
      val az = aZero(ai - 1)
      val bz = bZero(bi - 1)
      if (az >= 0 || bz >= 0){
        val aj = Math.max(az, 0)
        val bj = Math.max(bz, 0)
        if (minLength(ai)(bi) + 1 < minLength(aj)(bj)) {
          minLength(aj)(bj) = minLength(ai)(bi) + 1
          prev(aj)(bj) = '0'::prev(ai)(bi)
          startWithZero.enqueue((aj, bj))
        }
      }else if (result.isEmpty || result.head == '1') {
        result = '0'::prev(ai)(bi)
      }
      val ao = aOne(ai - 1)
      val bo = bOne(bi - 1)
      if (ao >= 0 || bo >= 0){
        val aj = Math.max(ao, 0)
        val bj = Math.max(bo, 0)
        if (minLength(ai)(bi) + 1 < minLength(aj)(bj)){
          minLength(aj)(bj) = minLength(ai)(bi) + 1
          prev(aj)(bj) = '1'::prev(ai)(bi)
          startWithOne.enqueue((aj, bj))
        }
      }else if (result.isEmpty){
        result = '1'::prev(ai)(bi)
      }
    }
  }
  println(result.mkString(""))
  class MaxBit(val size: Int) {
    private val array = Array.fill(size){Int.MinValue}
    def increase(position: Int, value: Int): Unit = {
      if (position < size && array(position) < value){
        array(position) = value
        increase(position + ((position + 1) & ~position), value)
      }
    }
    def apply(position: Int): Int = {
      if (position >= 0){
        Math.max(array(position), apply(position - ((position + 1) & ~position)))
      }else Int.MinValue
    }
  }
}



Measured memory_bytes: 614732