Under construction

Still being built. Things may change

Almost Identical Programs

Interview

Time limit2sMemory limit512 MB

Summary
Given two program strings, decide whether they are identical, differ only in one string literal at the same position, or are otherwise different.
Level

Medium4 of 10

Topics
String, Implementation, Two pointers
Solved
No attempts yet

Problem

The programming contest named Concours de Programmation Comtemporaine Interuniversitaire (CPCI) judges submissions much like the ICPC does. A contestant has to submit correct outputs for two different inputs before a solution counts as accepted. Each submission also has to include the program that produced the output. A pair of submissions counts as a correct solution only when both outputs are correct and the two submissions include an identical program.

Many contestants still put a different version of their program into the second submission. They modify a single string literal that holds the input file name so the program reads the other input file. The organizers of CPCI want to show a special error message for such close submissions so that contestants see what went wrong. Your task is to detect them.

Input

The input consists of at most 100 datasets. Each dataset has the following format.

s1
s2

Each of s1 and s2 is a string written on its own line, with a length between 1 and 200, inclusive. They are the first and the second submitted program, in that order. A program consists of lowercase letters (a, b, ..., z), uppercase letters (A, B, ..., Z), digits (0, 1, ..., 9), double quotes ("), and semicolons (;). The number of double quotes in a program is always even.

The end of the input is marked by a line containing a single period (.).

Output

For each dataset, print the judge result on one line.

If the two programs are identical, print IDENTICAL. If they differ in exactly one corresponding string literal and agree everywhere else, print CLOSE. Otherwise print DIFFERENT.

A string literal is a possibly empty sequence of characters between an odd-numbered occurrence of a double quote and the next occurrence of a double quote.

Examples6

  1. Example 1

    Input
    print"hello";print123
    print"hello";print123
    read"B1input";solve;output;
    read"B2";solve;output;
    read"C1";solve;output"C1ans";
    read"C2";solve;output"C2ans";
    """"""""
    """42"""""
    slow"program"
    fast"code"
    "super"fast"program"
    "super"faster"program"
    X""
    X
    I"S""CREAM"
    I"CE""CREAM"
    11"22"11
    1"33"111
    .
    
    Expected output
    IDENTICAL
    CLOSE
    DIFFERENT
    CLOSE
    DIFFERENT
    DIFFERENT
    DIFFERENT
    CLOSE
    DIFFERENT
    
  2. Example 2

    Input
    a
    a
    A
    a
    ;
    ;
    1
    2
    .
    
    Expected output
    IDENTICAL
    DIFFERENT
    IDENTICAL
    DIFFERENT
    
  3. Example 3

    Input
    a""b
    a""b
    a""b
    a"x"b
    a"x"b
    a""b
    .
    
    Expected output
    IDENTICAL
    CLOSE
    CLOSE
    
  4. Example 4

    Input
    p"a"q"b"r
    p"A"q"b"r
    p"a"q"b"r
    p"A"q"B"r
    p"a"q"b"r
    p"a"q"b"R
    .
    
    Expected output
    CLOSE
    DIFFERENT
    DIFFERENT
    
  5. Example 5

    Input
    ""
    ""
    .
    
    Expected output
    IDENTICAL
    
  6. Example 6

    Input
    abc;123
    abd;123
    "abc"
    "abd"
    "a"b"c"
    "a"b"c"
    .
    
    Expected output
    DIFFERENT
    CLOSE
    IDENTICAL