import scala.annotation.tailrec

object Main extends App {

  import scala.io.StdIn._
  import scala.math._
  solve
  def solve: Unit = {
    val a = readLine.trim
    if (a == ".") return
    val b = readLine.trim
    println(parse(a.toList, b.toList) match {
      case Identical ⇒ "IDENTICAL"
      case Close ⇒ "CLOSE"
      case Different ⇒ "DIFFERENT"
    })
    solve
  }
  sealed trait Similarity
  case object Identical extends Similarity
  case object Close extends Similarity
  case object Different extends Similarity
  sealed trait State
  case class ConstString(string: List[Char]) extends State
  case class NonString(state: List[Char]) extends State
  def parse(stateA: List[Char], stateB: List[Char]): Similarity = {
    @tailrec
    def sub(state: List[Char], result: List[Char]): (List[Char], List[Char]) = {
      state match {
        case Nil ⇒ (result, Nil)
        case '"'::t ⇒ (result, t)
        case h::t ⇒ sub(t, h::result)
      }
    }
    @tailrec
    def subParse(state: List[Char], result: List[State] = Nil): List[State] = {
      state match {
        case Nil ⇒ result
        case '"'::t ⇒ sub(t, Nil) match {
          case (str, rest) ⇒ subParse(rest, ConstString(str)::result)
        }
        case t ⇒ sub(t, Nil) match {
          case (str, Nil) ⇒ NonString(str)::result
          case (str, t) ⇒ subParse('"'::t, NonString(str)::result)
        }
      }
    }
    @tailrec
    def compare(a: List[Char], b: List[Char]): Boolean = {
      (a, b) match {
        case (ha::ta, hb::tb) if ha == hb ⇒ compare(ta, tb)
        case (Nil, Nil) ⇒ true
        case _ ⇒ false
      }
    }
    @tailrec
    def compareState(a: List[State], b: List[State], result: Similarity = Identical): Similarity = {
      (a, b) match {
        case (ConstString(sa)::ta, ConstString(sb)::tb) ⇒ if (compare(sa, sb)) compareState(ta, tb, result)
        else result match {
          case Close ⇒ Different
          case _ ⇒ compareState(ta, tb, Close)
        }
        case (NonString(sa)::ta, NonString(sb)::tb) if compare(sa, sb) ⇒ compareState(ta, tb, result)
        case (Nil, Nil) ⇒ result
        case _ ⇒ Different
      }
    }
    val parsedA = subParse(stateA)
    val parsedB: List[State] = subParse(stateB)
    compareState(parsedA, parsedB)
  }
  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}
