Problem:
Almost Identical Programs

The programming contest named
Concours de Programmation Comtemporaine Interuniversitaire (CPCI)
has a judging system similar to that of ICPC;
contestants have to submit correct outputs for two different inputs
to be accepted as a correct solution.

Each of the submissions should include the program that generated
the output. A pair of submissions is judged to be a correct
solution when, in addition to the correctness of the outputs, they
include an identical program.

Many contestants, however, do not stop including a different version
of their programs in their second submissions, after modifying a
single string literal in their programs representing
the input file name, attempting to process different input.

The organizers of CPCI are exploring the possibility of showing a
special error message for such close submissions,
indicating contestants what's wrong with such submissions.

Your task is to detect such close submissions.

Input

The input consists of at most 100 datasets, each in the following format.

s1
s2

Each of s1 and s2 is
a string written in a line, with the length between 1 and 200, inclusive.
They are the first and the second submitted programs respectively.

A program consists of lowercase letters (a, b, ..., z), uppercase letters (A, B, ..., Z),
digits (0, 1, ..., 9), double quotes ("), and semicolons (;).
When double quotes occur in a program, there are always even number of them.

The end of the input is indicated by a line containing one '.' (period).

Output

For each dataset, print the judge result in a line.

If the given two programs are identical, print IDENTICAL.
If two programs differ with only one corresponding string literal, 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.

Sample 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
.

Output for the Sample Input

IDENTICAL
CLOSE
DIFFERENT
CLOSE
DIFFERENT
DIFFERENT
DIFFERENT
CLOSE
DIFFERENT

Solution in C# (judge verdict: Accepted)

using System.Collections.Generic;
using System.Linq;
using System;

public class Moji
{
    public string s { get; set; }
    public string smd { get; set; }
}

public class hello
{
    public static void Main()
    {
        while (true)
        {
            var s0 = Console.ReadLine().Trim();
            if (s0 == ".") break;
            var s1 = Console.ReadLine().Trim();
            if (s0 == s1) { Console.WriteLine("IDENTICAL");  goto next; }
            var dq0 = new List<string>();
            var dq1 = new List<string>();
            var aa0 = new Moji { s = s0 };
            var aa1 = new Moji { s = s1 };
            var a0 = GetDQ(dq0, aa0);
            var a1 = GetDQ(dq1, aa1);
            if (!a0  | !a1) { Console.WriteLine("DIFFERENT"); goto next; }
            if (aa0.smd != aa1.smd) { Console.WriteLine("DIFFERENT"); goto next; }
            if (dq0.Count() != dq1.Count()) { Console.WriteLine("DIFFERENT"); goto next; }
            var dcount = 0;
            for (int i = 0; i < dq0.Count(); i++)
            {
                if (dq0[i] != dq1[i]) dcount++;
                if (dcount > 1) { Console.WriteLine("DIFFERENT"); goto next; }
            }
            Console.WriteLine("CLOSE");
            next:;
        }
    }
    public static bool GetDQ(List<string> dq, Moji m)
    {
        var si = 0;
        var p = new List<int>();
        for (int i = 0; i < m.s.Length; i++)
        {
            var pos = m.s.IndexOf('\"', si);
            if (pos != -1)
            {
                p.Add(pos);
                si = pos + 1;
            }
            else break;
        }
        if (p.Count == 0)
        {
            m.smd = m.s;
            return false;
        }
        for (int i = 0; i <= p.Count / 2; i += 2)
            dq.Add(m.s.Substring(p[i] + 1, p[i + 1] - p[i] - 1));
        var rmoji = m.s.Substring(0, p[0]);
        if (p.Count() == 2) goto one;
        for (int i = 1; i < p.Count()-1; i+=2)
        {
            rmoji += m.s.Substring(p[i] + 1, p[i + 1] - p[i] - 1);
        }
        one:;
        rmoji += m.s.Substring(p[p.Count()-1]);
        m.smd = rmoji;
        return true;
    }
}