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.  s 1  s 2  Each of s 1 and s 2 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 (Python):



s = {0:"IDENTICAL", 1:"CLOSE", 2:"DIFFERENT"}
while True:
	s1 = input();
	if s1 == '.': break
	s1 = list(s1)
	s2 = list(input())
	w1, w2 = len(s1), len(s2)
	i = j = 0
	ans, k = -1, 0
	while i < w1 and j < w2:
		if s1[i] != s2[j]: ans = 2; break
		if s1[i] == '"':
			i, j = i+1, j+1
			wi, wj = i, j
			while s1[i] != '"': i += 1
			while s2[j] != '"': j += 1
			if s1[wi:i] != s2[wj:j]: k += 1
			if k > 1: ans = 2; break
		i, j = i+1, j+1
	if ans < 0:
		if (i < w1 and j < w2 and s1[i] == s2[j]) \
		    or (i == w1 and j == w2): ans = k
		else: ans = 2
	print(s[ans])

Solution (Python):
while True:
    s1 = input()
    if s1 == ".":
        break
    s2 = input()

    listed_s1 = [[]]
    listed_s2 = [[]]
    start = 0
    now = 0
    for i in range(len(s1)):
        if s1[i] == "\"" and not start:
            listed_s1.append([])
            now += 1
            start = 1
            listed_s1[now].append(s1[i])
        elif s1[i] == "\"" and start:
            listed_s1[now].append(s1[i])
            listed_s1.append([])
            now += 1
            start = 0
        else:
            listed_s1[now].append(s1[i])

    now = 0
    for i in range(len(s2)):
        if s2[i] == "\"" and not start:
            listed_s2.append([])
            now += 1
            start = 1
            listed_s2[now].append(s2[i])
        elif s2[i] == "\"" and start:
            listed_s2[now].append(s2[i])
            listed_s2.append([])
            now += 1
            start = 0
        else:
            listed_s2[now].append(s2[i])

    fist_wrong = 0
    ans = "IDENTICAL"
    if len(listed_s1) != len(listed_s2):
        ans = "DIFFERENT"

    for i in range(min(len(listed_s1), len(listed_s2))):
        if ans == "DIFFERENT":
            break
        if listed_s1[i] != listed_s2[i]:
            if listed_s1[i][0] == "\"" and listed_s2[i][-1] == "\"" and listed_s2[i][0] == "\"" and listed_s2[i][-1] == "\"":
                if fist_wrong:
                    ans = "DIFFERENT"
                else:
                    fist_wrong = 1
                    ans = "CLOSE"

            else:
                ans = "DIFFERENT"


    print(ans)

Solution (Python):
def testcase_ends():
    s = input()
    if s == '.':
        return True

    t = input()

    if s == t:
        print('IDENTICAL')
        return False

    s0 = s.split('"')[0::2]
    s1 = s.split('"')[1::2]
    t0 = t.split('"')[0::2]
    t1 = t.split('"')[1::2]

    if s0 != t0:
        print('DIFFERENT')
        return False

    if len(s1) != len(t1):
        print('DIFFERENT')
        return False

    if len([(ss, tt) for ss, tt in zip(s1, t1) if ss != tt]) == 1:
        print('CLOSE')
    else:
        print('DIFFERENT')

    return False

def main():
    while not testcase_ends():
        pass

main()

Solution (Python):


while(True):
    S0 = str(input())
    if S0 == ".":
        exit()
    S1 = str(input())
    if S0 == S1:
        print("IDENTICAL")
        continue
    S0else = list(S0.split('"')[0::2])
    S1else = list(S1.split('"')[0::2])
    if S0else != S1else:
        print("DIFFERENT")
        continue
    S0str = list(S0.split('"')[1::2])
    S1str = list(S1.split('"')[1::2])
    if len(S0str) != len(S1str):
        print(S0str, S1str)
        print("DIFFERENT")
        continue
    OK = 1
    for i in range(len(S0str)):
        if S0str[i] != S1str[i]:
            OK -= 1
    if OK < 0:
        print("DIFFERENT")
    elif OK >= 0:
        print("CLOSE")

Solution (Python):
while (True):
    s1=input()
    if (s1=="."):
        break
    s2=input()
    l1=s1.split("\"")
    l2=s2.split("\"")
   
    if (len(l1)!=len(l2)):
        print("DIFFERENT")
        continue
    error=0
    for i in range(len(l1)):
        
        if (l1[i]!=l2[i] and i%2==0):
            print("DIFFERENT")
            error=-1
            break
        if (len(l1[i])!=len(l2[i])):
            error+=1
        else:
            for j in range(min(len(l1[i]),len(l2[i]))):
            
                if (l1[i][j]!=l2[i][j]):
                    error+=1
                    break

    if (error==0):
        print("IDENTICAL")
    elif (error==1):
        print("CLOSE")
    elif(error>=2):
        print("DIFFERENT")

Solution (Python):
from functools import lru_cache
ans = ['IDENTICAL', 'DIFFERENT', 'CLOSE']

def compare(s1,s2):
    if s1 == s2:
        return 0
 
    l1,l2 = s1.split('"'),s2.split('"')
    if len(l1) != len(l2):
        return 1
 
    cnt = 0
    for i in range(len(l1)):
        if i%2 == 0:
            if l1[i] != l2[i]:
                return 1
        else:
            if l1[i] != l2[i]:
                cnt += 1
            if cnt > 1:
                return 1
    return 2

while True:
    str1 = input()
    if str1 == ".":
        break
    str2 = input()
    print(ans[compare(str1,str2)])

Solution (Python):
def solve(s1, s2):
    if len(s1) != len(s2):
        return "DIFFERENT"
    for i in range(0, len(s1), 2):
        if s1[i] != s2[i]:
            return "DIFFERENT"
    diff_count = 0
    for i in range(1, len(s1), 2):
        if s1[i] != s2[i]:
            diff_count += 1
    if diff_count == 0:
        return "IDENTICAL"
    elif diff_count == 1:
        return "CLOSE"
    else:
        return "DIFFERENT"


if __name__ == "__main__":
    i = 1
    while True:
        s1 = input()
        if s1 == ".":
            break
        s2 = input()
        
        s1_list = s1.split('"')
        s2_list = s2.split('"')
        print(solve(s1_list, s2_list))

Solution (Python):
def f(S):
    S_not_in_q = []
    S_in_q = []
    tmp = ''
    i = 0
    while i < len(S):
        if S[i] == '"':
            if tmp != '':
                S_not_in_q.append(tmp)
            tmp = ''
            i += 1
            while S[i] != '"':
                tmp += S[i]
                i += 1
            else:
                S_in_q.append(tmp)
                tmp = ''
                i += 1
        else:
            tmp += S[i]
            i += 1
    else:
        if tmp != '':
            S_not_in_q.append(tmp)
    return S_not_in_q, S_in_q
    
while True:
    S1 = input()
    if S1 == '.':
        break
    S2 = input()

    if (S1 == S2):
        print('IDENTICAL')
        continue

    S1_not_in_q, S1_in_q = f(S1)
    S2_not_in_q, S2_in_q = f(S2)

    if (S1_not_in_q != S2_not_in_q):
        print('DIFFERENT')
        continue
    else:
        if len(S1_in_q) != len(S2_in_q):
            print('DIFFERENT')
            continue
        else:
            count = 0
            for i in range(len(S1_in_q)):
                if S1_in_q[i] != S2_in_q[i]:
                    count += 1
            if count < 2:
                print("CLOSE")
                continue
            else:
                print("DIFFERENT")
                continue

Solution (Python):
while 1:
    s1 = input().split('"')
    if s1 == ['.']:
        break
    s2 = input().split('"')
    if len(s1) != len(s2):
        print("DIFFERENT")
        continue
    r = [0]*2
    for i in range(len(s1)):
        if s1[i] != s2[i]:
            r[i%2] += 1
    if [0,1]<r:
        print("DIFFERENT")
    else:
        print(["IDENTICAL","CLOSE"][r[1]])

Solution (Python):

import sys
if sys.version_info[0]>=3: raw_input=input

def solve(s,t):
	if s==t:
		return 'IDENTICAL'
	s=s.split('"')
	t=t.split('"')
	if len(s)==len(t):
		k0=sum(s[i]!=t[i] for i in range(0,len(s),2))
		k1=sum(s[i]!=t[i] for i in range(1,len(s),2))
		if k0==0 and k1==1:
			return 'CLOSE'
	return 'DIFFERENT'

try:
	while True:
		s=raw_input().strip()
		if s=='.': break
		t=raw_input().strip()
		print(solve(s,t))
except EOFError:
	pass

Solution (Python):

import sys
if sys.version_info[0]>=3: raw_input=input

def solve(s,t):
	if s==t:
		return 'IDENTICAL'
	s=s.split('"')
	t=t.split('"')
	if len(s)==len(t):
		k0=sum(s[i]!=t[i] for i in range(0,len(s),2))
		k1=sum(s[i]!=t[i] for i in range(1,len(s),2))
		if k0==0 and k1==1:
			return 'CLOSE'
	return 'DIFFERENT'

try:
	while True:
		s=raw_input().strip()
		if s=='.': break
		t=raw_input().strip()
		print(solve(s,t))
except EOFError:
	pass

Solution (Python):


import re

def rdp_connect() -> bool:
    global s1, s2
    s1 = input()
    if s1 == '.':
        return False
    s2 = input()
    return True

def rdp_token(s: str):
    res = []
    while s:
        match = re.match(r'[a-zA-Z0-9;]+', s)
        if match:
            res.append(s[:match.end()])
            s = s[match.end():]
            continue
        match = re.match(r'"[^"]*"', s)
        if match:
            res.append(s[:match.end()-1])
            s = s[match.end():]
            continue
        break
    return res

def rdp_check() -> bool:
    l1 = rdp_token(s1)
    l2 = rdp_token(s2)
    if len(l1) != len(l2):
        return False
    flag = True
    for t1, t2 in zip(l1, l2):
        if t1 == t2:
            continue
        if t1[0] == t2[0] == '"' and flag:
            flag = False
        else:
            return False
    return True

if __name__ == '__main__':
    while rdp_connect():
        if s1 == s2:
            print('IDENTICAL')
        elif rdp_check():
            print('CLOSE')
        else:
            print('DIFFERENT')

Solution (Python):
import re

def solve(s, t):
	if s == t:
		return "IDENTICAL"
	s = s.split("\"")
	t = t.split("\"")
	if len(s) == len(t):
		a = sum(s[i] != t[i] for i in range(0, len(s), 2))
		b = sum(s[i] != t[i] for i in range(1, len(s), 2))
		if a == 0 and b == 1:
			return "CLOSE"
	return "DIFFERENT"

while True:
	s = input()
	if s == ".":
		break
	t = input()
	print(solve(s, t))

Solution (Python):
while True:
    try:
        s1 = input()
        s2 = input()
    except:
        break
    c = 0
    while True:
        try:
            i = s1.index("\"")
            if s1[:i] != s2[:i]:
                print("DIFFERENT")
                break
        except:
            if s1 == s2:
                if c == 0:
                    print("IDENTICAL")
                    break
                else:
                    print("CLOSE")
                    break
            else:
                print("DIFFERENT")
                break
        try:
            j1 = s1[i + 1:].index("\"")
            j2 = s2[i + 1:].index("\"")
        except:
            print("DIFFERENT")
            break
        if s1[i + 1:i + j1 + 1] != s2[i + 1:i + j2 + 1]:
            c += 1
        if c == 2:
            print("DIFFERENT")
            break
        s1 = s1[i + j1 + 2:]
        s2 = s2[i + j2 + 2:]

Solution (Python):
while 1:
    s1 = input().split('\"')
    if s1[0] == '.': break
    s2 = input().split('\"')

    jdg = 1
    cnt_d = 0
    
    

    if len(s1) != len(s2): print("DIFFERENT")
    else:
        l = len(s1)
        i = 0
        while i < l:
            if s1[i] != s2[i]:
                cnt_d += 1
                if cnt_d == 1 and i % 2 == 1:
                    jdg = 1
                else:
                    jdg = 0
                    break
            i += 1

        if jdg == 1 and cnt_d == 1: print("CLOSE")
        elif jdg == 0 or cnt_d > 1: print("DIFFERENT")
        else: print("IDENTICAL")

Solution (Python):
while 1:
    s1 = input().split('"')
    l1 = len(s1)
    if s1[0] == ".": break
    s2 = input().split('"')
    l2 = len(s2)
    if l1 != l2:
        print("DIFFERENT")
        continue
    i = 0
    cnt = 0

    while 1:
        if s1[i] != s2[i]:
            print("DIFFERENT")
            break
        if i > l1-2:
            if cnt == 1:
                print("CLOSE")
                break
            else:
                print("IDENTICAL")
                break
        if s1[i+1] != s2[i+1]:
            if cnt == 1:
                print("DIFFERENT")
                break
            else: cnt = 1
        i += 2

Solution (Python):
while 1:
    s1 = input().split('\"')
    if s1[0] == '.': break
    s2 = input().split('\"')

    jdg = 1
    cnt_d = 0

    if len(s1) != len(s2): print("DIFFERENT")
    else:
        l = len(s1)
        i = 0
        while i < l:
            if s1[i] != s2[i]:
                cnt_d += 1
                if cnt_d == 1 and i % 2 == 1:
                    jdg = 1
                else:
                    jdg = 0
                    break
            i += 1

        if jdg == 1 and cnt_d == 1: print("CLOSE")
        elif jdg == 0 or cnt_d > 1: print("DIFFERENT")
        else: print("IDENTICAL")

Solution (Python):
while 1:
    s1 = input().split('"')
    l1 = len(s1)
    if s1[0] == ".": break
    s2 = input().split('"')
    l2 = len(s2)
    if l1 != l2:
        print("DIFFERENT")
        continue
    i = 0
    cnt = 0
    while 1:
        if s1[i] != s2[i]:
            print("DIFFERENT")
            break
        if i > l1-2:
            if cnt == 1:
                print("CLOSE")
                break
            else:
                print("IDENTICAL")
                break
        if s1[i+1] != s2[i+1]:
            if cnt == 1:
                print("DIFFERENT")
                break
            else: cnt = 1
        i += 2

Solution (Python):
while 1:
    s1 = input().split('\"')
    if s1[0] == '.': break
    s2 = input().split('\"')

    jdg = 1
    cnt_d = 0

    if len(s1) != len(s2): print("DIFFERENT")
    else:
        l = len(s1)
        i = 0
        while i < l:
            if s1[i] != s2[i]:
                cnt_d += 1
                if cnt_d == 1 and i % 2 == 1:
                    jdg = 1
                else:
                    jdg = 0
                    break
            i += 1

        if jdg == 1 and cnt_d == 1: print("CLOSE")
        elif jdg == 0 or cnt_d > 1: print("DIFFERENT")
        else: print("IDENTICAL")

Solution (Python):
results=[]
while True:
    a=input().split("\"")
    if a[0]==".":
        break
    b=input().split("\"")
    count1=0
    count2=0
    if len(a) != len(b):
        results.append(2)
    else:
        for i in range(len(a)):
            if(i%2==1):
                if len(a[i]) != len(b[i]):
                    count1+=1
                else:
                    for k,l in zip(a[i],b[i]):
                        if(k!=l):
                            count1+=1
            else:
                if len(a[i]) != len(b[i]):
                    count2+=1
                else:
                    for k,l in zip(a[i],b[i]):
                        if(k!=l):
                            count2+=1           
        if count1==0 and count2==0:
            results.append(0)
        elif count1==1 and count2==0:
            results.append(1)
        else:
            results.append(2)
for i in results:
    if i==0:
        print("IDENTICAL")
    if i==1:
        print("CLOSE")
    if i==2:
        print("DIFFERENT")

Solution (Python):
while 1:
	s1=input().split('"')
	if s1[0]==".":
		break
	s2=input().split('"')
	
	cnt1=0
	cnt2=0
	flag=0
	
	if len(s1)!=len(s2):
		print("DIFFERENT")
	else:
		i=0
		while i<len(s1):
			if s1[i]==s2[i]:
				cnt1+=1
			elif i%2==0:
				print("DIFFERENT")
				flag=1
				break
			else:
				cnt2+=1
				if cnt2>1:
					print("DIFFERENT")
					break
			i+=1
				
		if flag==0 and cnt2==1:
			print("CLOSE")
		if cnt1==len(s1):
			print("IDENTICAL")

Solution (Python):


def judge(ch1,ch2):
	if ch1!=ch2: return 1
	return 0

while 1:
	str1=input().split('"')
	if str1[0]=='.': break
	str2=input().split('"')
	l1=len(str1)
	l2=len(str2)
	flag=[0]*2
	if l1-l2!=0: flag[0]=1
	else:
		for j in range(l1):
			if len(str1[j])!=len(str2[j]):
				flag[j%2]+=1
			else:
				for i in range(len(str1[j])):
					if judge(str1[j][i],str2[j][i]):
						flag[j%2]+=1
					
				
			
		
	if flag[0]!=0 or flag[1]>=2: print("DIFFERENT")
	elif flag[1]==1: print("CLOSE")
	else: print("IDENTICAL")

Solution (Python):
s=[]

while 1:
    l1=input()
    if l1==".":
        break
    l2=input()

    sp1=l1.split('"')
    sp2=l2.split('"')
    
    t=0
    if len(sp1)==len(sp2):
        for i in range(len(sp1)):
            if i%2==1 and sp1[i]!=sp2[i]:
                t+=1
            elif i%2!=1 and sp1[i]!=sp2[i]:
                t+=2


    if sp1==sp2:
        s+=["IDENTICAL"]
    elif t==1:
        s+=["CLOSE"]
    else:
        s+=["DIFFERENT"]

for x in s:
    print(x)

Solution (Python):
while 1:
    s1 = input().split('"')
    if s1 == ['.']:
        break
    s2 = input().split('"')
    if len(s1) != len(s2):
        print("DIFFERENT")
        continue
    r = [0]*2
    for i in range(len(s1)):
        if s1[i] != s2[i]:
            r[i%2] += 1
    if [0,1]<r:
        print("DIFFERENT")
    else:
        print(["IDENTICAL","CLOSE"][r[1]])

Solution (Python):
ans=[]
while 1:
    s1=input().split('"')
    if s1==["."]: break
    s2=input().split('"')
    if len(s1)!=len(s2):
        ans.append("DIFFERENT")
        continue
    else:
        cnt=0
        flag=0
        for i in range(len(s1)):
            if s1[i]!=s2[i]:
                if i%2==0:
                    ans.append("DIFFERENT")
                    flag=1
                    break
                else:
                    cnt+=1
            else: pass
        if flag==1:
            continue
        else: pass
        if cnt==0:
            ans.append("IDENTICAL")
        elif cnt==1:
            ans.append("CLOSE")
        else: 
            ans.append("DIFFERENT")

for i in range(len(ans)):
    print(ans[i])

Solution (Python):
s1=[]
s2=[]
O=[]
while 1:
    A=input().split('"')
    if A==["."]:
        break
    i=0
    cnt=0
    B=input().split('"')
    l1=len(A)
    l2=len(B)
    if l1==l2:   
        while i<l1 and i<l2:
            if A[i]!=B[i]:
                cnt+=1
                if i%2==0:
                    cnt+=2
            i+=1
        if cnt==0:
            O.append("IDENTICAL")
        elif cnt==1:
            O.append("CLOSE")
        else:
            O.append("DIFFERENT")
    else:
        O.append("DIFFERENT")
for i in range(len(O)):
    print(O[i])

Solution (Python):
while 1:

    s1 = input().split('"')
    if s1 == ['.']:  
        break

    s2 = input().split('"')
    if len(s1) != len(s2):  
        print("DIFFERENT")
        continue

    cnt = 0
    for i in range(len(s1)):
        if s1[i] != s2[i]:
            cnt += 1
            if i%2==0:
                cnt += 2
        else:
            i+=1

    if cnt == 0:
        print("IDENTICAL")  
    elif cnt == 1:
        print("CLOSE")  
    else:
        print("DIFFERENT")

Solution (Python):
st = []
while(1):
    a1 = input()
    if a1 =='.':
        break
    a2 = input()
    b1 = a1.split('"')
    b2 = a2.split('"')
    cnt = 0
    if len(b1)==len(b2):
        for i in range(0,len(b1)):
            if i%2==0:
                if b1[i]!=b2[i]:
                    cnt+=10000
                    break
            if i%2!=0:
                if b1[i]!=b2[i]:
                    cnt+=1
    else:
        cnt+=10000
    
    if cnt>1:
        st.append("DIFFERENT")
    if cnt==1:
        st.append("CLOSE")
    if cnt==0:
        st.append("IDENTICAL")

for i in range(len(st)):
    print(st[i])

Solution (Python):
while 1:
    s1=input().split('"')
    if s1[0]==".":
        break
    s2=input().split('"')
     
    cnt1=0
    cnt2=0
    flag=0
     
    if len(s1)!=len(s2):
        print("DIFFERENT")
    else:
        i=0
        while i<len(s1):
            if s1[i]==s2[i]:
                cnt1+=1
            elif i%2==0:
                print("DIFFERENT")
                flag=1
                break
            else:
                cnt2+=1
                if cnt2>1:
                    print("DIFFERENT")
                    break
            i+=1
                 
        if flag==0 and cnt2==1:
            print("CLOSE")
        if cnt1==len(s1):
            print("IDENTICAL")

Solution (Python):
while 1:
    list1=input().split('"')
    if list1[0]==".":
        break
    list2=input().split('"')
     
    cnt1=0
    cnt2=0
    flag=0
     
    if len(list1)!=len(list2):
        print("DIFFERENT")
    else:
        i=0
        while i<len(list1):
            if list1[i]==list2[i]:
                cnt1+=1
            elif i%2==0:
                print("DIFFERENT")
                flag=1
                break
            else:
                cnt2+=1
                if cnt2>1:
                    print("DIFFERENT")
                    break
            i+=1
                 
        if flag==0 and cnt2==1:
            print("CLOSE")
        if cnt1==len(list1):
            print("IDENTICAL")

Solution (Python):
while 1:
    list1=input().split('"')
    if list1[0]==".":
        break
    list2=input().split('"')
     
    cnt1=0
    cnt2=0
    flag=0
     
    if len(list1)!=len(list2):
        print("DIFFERENT")
    else:
        i=0
        while i<len(list1):
            if list1[i]==list2[i]:
                cnt1+=1
            elif i%2==0:	
                print("DIFFERENT")
                flag=1
                break
            else:
                cnt2+=1
                if cnt2>1:
                    print("DIFFERENT")
                    break
            i+=1
                 
        if flag==0 and cnt2==1:
            print("CLOSE")
        if cnt1==len(list1):
            print("IDENTICAL")

Solution (Python):
while True:
    list1=input().split('"')
    if list1[0]==".":
        break
    list2=input().split('"')
     
    cnt1=0
    cnt2=0
    flag=0
     
    if len(list1)!=len(list2):
        print("DIFFERENT")
    else:
        i=0
        while i<len(list1):
            if list1[i]==list2[i]:
                cnt1+=1
            elif i%2==0:	
                print("DIFFERENT")
                flag=1
                break
            else:
                cnt2+=1
                if cnt2>1:
                    print("DIFFERENT")
                    break
            i+=1
                 
        if flag==0 and cnt2==1:
            print("CLOSE")
        if cnt1==len(list1):
            print("IDENTICAL")

Solution (Python):
while(1):
    a = input()
    if(a == '.'):
        break
    b = input()
    n = len(a)
    m = len(b)
    l = 0;
    flag = 0
    idx_dif = 0
    error_cou = 0

    while(1):
        if(l >= n-1 or l+idx_dif >= m-1):
            flag = 2

        if(flag == 0):
            for i in range(l,n):
                if(a[i] == '\"'):
                    if(i+idx_dif < m and a[l:i+1] == b[l+idx_dif:i+idx_dif+1]):
                        l = i+1
                        flag = 1
                    else:
                        flag = 2
                    break

                elif(i == n-1):
                    if(a[l:i] != b[l+idx_dif:m-1]):
                        flag = 2
                    else:
                        l = n-1
                    break
                if(flag != 0):
                    break

        elif(flag == 1):
            for i in range(l,n):
                if(a[i] == '\"'):
                    for j in range(l+idx_dif,m):
                        if(b[j] == '\"'):
                            if(a[l:i+1] != b[l+idx_dif:j+1]):
                                error_cou += 1
                            idx_dif = j-i
                            l = i+1
                            flag = 0
                            break
                        if(j == m-1):
                            flag = 2
                            break

                if(flag != 1):
                    break

        if(flag == 2 or l >= n-1 or l+idx_dif >= m-1):
            break

    if(error_cou >= 2 or flag == 2):
        print("DIFFERENT")
    elif(error_cou == 1):
        print("CLOSE")
    elif(error_cou == 0):
        print("IDENTICAL")

Solution (Python):
while(1):
    a = input()
    if(a == '.'):
        break
    b = input()
    n = len(a)
    m = len(b)
    l = 0
    flag = 0
    idx_dif = 0
    error_cou = 0

    while(1):
        if(flag == 0):
            for i in range(l,n):
                if(a[i] == '\"'):
                    if(i+idx_dif < m and a[l:i+1] == b[l+idx_dif:i+idx_dif+1]):
                        l = i+1
                        flag = 1
                    else:
                        flag = 2
                    break

                elif(i == n-1):
                    if(a[l:i] != b[l+idx_dif:m-1]):
                        flag = 2
                    else:
                        l = n-1

        elif(flag == 1):
            for i in range(l,n):
                if(a[i] == '\"'):
                    for j in range(l+idx_dif,m):
                        if(b[j] == '\"'):
                            if(a[l:i+1] != b[l+idx_dif:j+1]):
                                error_cou += 1
                            idx_dif = j-i
                            l = i+1
                            flag = 0
                            break
                        if(j == m-1):
                            flag = 2
                            break
                if(flag != 1):
                    break

        if(flag == 2 or l >= n-1 or l+idx_dif >= m-1):
            break

    if(error_cou >= 2 or flag == 2):
        print("DIFFERENT")
    elif(error_cou == 1):
        print("CLOSE")
    elif(error_cou == 0):
        print("IDENTICAL")

Solution (Python):
while(1):
    a = input()
    if(a == '.'):
        break
    b = input()
    n = len(a)
    m = len(b)
    l = 0
    flag = 0
    idx_dif = 0
    error_cou = 0
 
    while(1):
        if(flag == 0):
            for i in range(l,n):
                if(a[i] == '\"'):
                    if(i+idx_dif < m and a[l:i+1] == b[l+idx_dif:i+idx_dif+1]):
                        l = i+1
                        flag = 1
                    else:
                        flag = 2
                    break
 
                elif(i == n-1):
                    if(a[l:i] != b[l+idx_dif:m-1]):
                        flag = 2
                    else:
                        l = n-1
 
        elif(flag == 1):
            for i in range(l,n):
                if(a[i] == '\"'):
                    for j in range(l+idx_dif,m):
                        if(b[j] == '\"'):
                            if(a[l:i+1] != b[l+idx_dif:j+1]):
                                error_cou += 1
                            idx_dif = j-i
                            l = i+1
                            flag = 0
                            break
                        if(j == m-1):
                            flag = 2
                            break
                if(flag != 1):
                    break
 
        if(flag == 2 or l >= n-1 or l+idx_dif >= m-1):
            break
 
    if(error_cou >= 2 or flag == 2):
        print("DIFFERENT")
    elif(error_cou == 1):
        print("CLOSE")
    elif(error_cou == 0):
        print("IDENTICAL")

Solution (Python):
A=[]
while True:	
	a=input().split('"')
	if a[0]==".":
		break
	b=input().split('"')
	
	cnt=0

	if len(a)!=len(b):
		A.append(-1)
	else:
		for i in range(len(a)):
			if(a[i]==b[i]):
				pass
			else:
				if i%2==1:
					cnt+=1
				else:
					cnt+=2
		if cnt>=2:
			A.append(-1)
		if cnt==1:
			A.append(0)
		if cnt==0:
			A.append(1)

A.reverse()

for i in range(len(A)):
	tmp=A.pop()
	if tmp==-1:
		print("DIFFERENT")
	elif tmp==0:
		print("CLOSE")
	else:
		print("IDENTICAL")

Solution (Python):
ans=[]

while 1:
	s1=input().split('"')
	if s1[0]==".":
		break

	s2=input().split('"')
	
	if len(s1)!=len(s2):
		ans.append("DIFFERENT")
		continue
	else:
	
		cnt=0
		flag=0
		
		for i in range(len(s1)):
		
			if s1[i]!=s2[i]:
			
				if i==0:
					flag=1
					break
					
				elif i%2==0:
					flag=1
					break
				else:
					cnt+=1
			
		if flag==1 or cnt>1:
			ans.append("DIFFERENT")
		elif cnt==1:
			ans.append("CLOSE")
		else:
			ans.append("IDENTICAL")

for a in ans:
	print(a)

Solution (Python):
s=[]
while True:
    l1=input()
    if l1==".":
        break
    l2=input()
 
    sp1=l1.split('"')
    sp2=l2.split('"')
     
    m=0
    if len(sp1)==len(sp2):
        for i in range(len(sp1)):
            if i%2==1 and sp1[i]!=sp2[i]:
                m+=1
            elif i%2!=1 and sp1[i]!=sp2[i]:
                m+=2
 
 
    if sp1==sp2:
        s+=["IDENTICAL"]
    elif m==1:
        s+=["CLOSE"]
    else:
        s+=["DIFFERENT"]
 
for x in s:
    print(x)

Solution (Python):


while(True):
	i=0
	tmp=0
	a=input().split('"') 
	aL=len(a)
	if a[0] ==".":
		break
	b=input().split('"')
	bL=len(b)
		
	if aL != bL:
		print("DIFFERENT")
	else:
		while(True):
			if a[i] != b[i]:
				print("DIFFERENT")
				break
			elif i > aL-2:
				if tmp==1:
					print("CLOSE")
					break
				else:
					print("IDENTICAL")
					break
			elif a[i+1] != b[i+1]:
				if tmp==1:
					print("DIFFERENT")
					break
				else: tmp=1
			i +=2