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):
while True:
    s1 = input()
    if s1 == '.':
        break
    s2 = input()

    if s1 == s2:
        print("IDENTICAL")
        continue

    s2 = s2.split('"')
    s1 = s1.split('"')
    
    
    count = 0
    isTmp = False
    if s1[0] == '"' and s2[0] == '"':
        isTmp = True

    hoge = True
    for i in range(len(s1)):
        if len(s1) != len(s2):
            print("DIFFERENT")
            hoge = False
            break
        if count > 1:
            print("DIFFERENT")
            hoge = False
            break

        if not isTmp:
            if i % 2 == 0:
                if s1[i] != s2[i]:
                    print("DIFFERENT");
                    hoge = False
                    break
            if i % 2 == 1:
                if s1[i] != s2[i]:
                    count += 1
        else:
            if i+1 % 2 == 0:
                if s1[i] != s2[i]:
                    print("DIFFERENT");
                    hoge = False
                    break
            if i+1 % 2 == 1:
                if s1[i] != s2[i]:
                    count += 1

    if count == 1 and hoge:
        print("CLOSE")

Solution (Python):


"""

"""

while True:
    s1 = raw_input()

    if s1 == '.':
        break

    s2 = raw_input()

    if s1 == s2:
        print "IDENTICAL"

    elif s1.count('"') != s2.count('"'):
        print "DIFFERENT"

    else:
        s1 = s1.split('"')
        s2 = s2.split('"')
        
        cnt = 0

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

        print "CLOSE" if cnt == 1 else "DIFFERENT"

Solution (Python):
while True:
    s1 = raw_input()
 
    if s1 == '.':
        break
 
    s2 = raw_input()

    s1 = s1.split('"')
    s2 = s2.split('"')

    if s1 == s2:
        print "IDENTICAL"
 
    elif len(s1) != len(s2):
        print "DIFFERENT"

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

        print "CLOSE" if cnt == 1 else "DIFFERENT"

Solution (Python):
def vals(arr):
    even = True
    res = [[], []]
    tmp = []
    for e in arr:
        if e == "\"":
            even = not even
            res[even].append(tmp)
            tmp = []
            continue
        tmp.append(e)
    even = not even
    res[even].append(tmp)
    return res


while True:
    str1 = input()
    if str1 == ".":
        break
    a = vals(str1)
    b = vals(input())
    res = 0
    if len(a[0]) != len(b[0]) or len(a[1]) != len(b[1]) :
        res = 2
    else:
        for (x, y) in zip(a[0], b[0]):
            if x != y:
                res = 2
                break
    if res == 0:
        for (a, b) in zip(a[1], b[1]):
            if a != b:
                res += 1
                if res == 2:
                    break
    if res == 0:
        print("IDENTICAL")
    elif res == 1:
        print("CLOSE")
    else:
        print("DIFFERENT")

Solution (Python):
def check(s1,s2):
    l1 = s1.split('"')
    l2 = s2.split('"')
    if len(l1) != len(l2):
        return "DIFFERENT"
    close = 0
    for i in range(len(l1)):
        if l1[i] != l2[i]:
            if i % 2 == 0: return "DIFFERENT"
            else : close += 1
    if close == 1: return "CLOSE"
    if close == 0: return "IDENTICAL"
    return "DIFFERENT"

if __name__ == '__main__':
    while True:
        s1 = input()
        if s1 == ".": break
        s2 = input()
        print(check(s1,s2))

Solution (Python):
def check(str1,str2):
    if not(len(str1)==len(str2)):
        return False 
    for i in range(len(str1)):
        if not(str1[i]==str2[i]):
            return False
    return True


def solve(s1,s2):
    
    if not(len(s1) == len(s2)):
        print("DIFFERENT")
        return
    flag = True
    for i in range(len(s1)):
        if not(check(s1[i],s2[i])):
            if i%2==1:
                if flag:
                    flag = False
                else:
                    print("DIFFERENT")
                    return
            else:
                print("DIFFERENT")
                return
    if flag:
        print("IDENTICAL")
    else:
        print("CLOSE")
        
    return


while True:
    s1=input().split('"')
    if s1[0] == '.':
        break
    s2 = input().split('"')
    solve(s1,s2)

Solution (Python):
def solve(s, t):
    s = s.split('"')
    t = t.split('"')

    if s == t:
        return "IDENTICAL"

    if len(s) == len(t):
        cnt = 0
        for i in range(len(s)):
            if s[i] != t[i] and i % 2 == 1:
                cnt += 1
            elif s[i] != t[i]:
                cnt += 2
        if cnt == 1:
            return 'CLOSE'

    return 'DIFFERENT'

while True:
    s1 = raw_input()

    if s1 == '.': break

    s2 = raw_input()

    print solve(s1, s2)

Solution (Python):
s1 = input().split('"')
while s1[0]!='.':
  miss = 0
  ans = "IDENTICAL"
  s2 = input().split('"')
  if len(s1) != len(s2):
    ans="DIFFERENT"
  else :
    for i in range(len(s1)):
      if i % 2 == 0 and s1[i] != s2[i]:
        ans="DIFFERENT"
        break
      if i % 2 == 1 and s1[i] != s2[i]:
        if ans == "CLOSE":
          ans="DIFFERENT"
          break
        else:
          ans = "CLOSE"
  print(ans)
  s1=input().split('"')

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

while True:
    s1 = input()
    if s1 == '.':
        break
    s2 = input()
    a = s1.strip().split('\"')
    b = s2.strip().split('\"')

    if len(a) != len(b):
        print("DIFFERENT")
    elif a[0::2] != b[0::2]:
        print("DIFFERENT")
    else:
        c = a[1::2]
        d = b[1::2]
        cnt = 0
        for i in range(len(c)):
            if c[i] != d[i]:
                cnt += 1
        if cnt == 0:
            print("IDENTICAL")
        elif cnt == 1:
            print("CLOSE")
        else:
            print("DIFFERENT")

Solution (Python):

while True:
    str1 = input()
    if str1 == ".":
        break

    str2 = input()

    if str1 == str2:
        print("IDENTICAL")
        continue


        
    str1 = str1.split("\"")
    str2 = str2.split("\"")
    if not len(str1)==len(str2):
        print("DIFFERENT")
        continue
    

    flg = 0
    for i in range(0,len(str1),2):
        if not str1[i] == str2[i]:
            flg = 1
            print("DIFFERENT")
            break
    if flg == 1:
        continue
    


    count = 0
    for i in range(1,len(str1),2):
        if not str1[i] == str2[i]: count +=1
        if count >= 2:
            break
    if count == 1:
        print("CLOSE")
    else:
        print("DIFFERENT")

Solution (Python):
while 1:
    s = input()
    if s=='.':
        break
    s=list(s.split('"'))
    t=list(input().split('"'))
    if s==t:
        print("IDENTICAL")
    elif len(s)!=len(t):
        print("DIFFERENT")
        continue
    else:
        flag = 0
        for i in range(0,len(s),2):
            if s[i] != t[i]:
                print("DIFFERENT")
                flag = 1
                break
        if flag == 1:
            continue
        for i in range(1,len(s),2):
            if s[i] != t[i]:
                flag+=1
                if flag == 2:
                    print("DIFFERENT")
                    break
        if flag == 1:
            print("CLOSE")

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

    w1 = s1.split('"')
    w2 = s2.split('"')

    if len(w1) != len(w2):
        result = "DIFFERENT"
    else:
        n = len(w1)
        result = "IDENTICAL"
        for i in range(n):
            if i % 2 == 0:
                if w1[i] != w2[i]:
                    result = "DIFFERENT"
                    break
            else:
                if w1[i] != w2[i]:
                    if result == "IDENTICAL":
                        result = "CLOSE"
                    else:
                        result = "DIFFERENT"
                        break

    print(result)

Solution (Python):
while True:
    s1 = input().split('"')
    if s1[0] == '.':
        exit()
    s2 = input().split('"')
    if len(s1) != len(s2):
        print('DIFFERENT')
        continue
    ans = 1
    for i in range(len(s1)):
        if i % 2 == 0:
            if s1[i] != s2[i]:
                ans = -1
        else:
            if s1[i] != s2[i]:
                ans -= 1
    if ans == 1:
        print('IDENTICAL')
    elif ans == 0:
        print('CLOSE')
    else:
        print('DIFFERENT')

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

    ans = None
    if s1 == s2:
        ans = 'IDENTICAL'

    if ans is None:
        s1 = s1.split('"')
        s2 = s2.split('"')
        if len(s1) == len(s2):
            miss = 0
            for p1, p2 in zip(s1[0::2], s2[0::2]):
                if p1 != p2:
                    miss = 2
            for p1, p2 in zip(s1[1::2], s2[1::2]):
                if p1 != p2:
                    miss += 1
            if miss <= 1:
                ans = 'CLOSE'

    if ans is None:
        ans = 'DIFFERENT'

    print(ans)

Solution (Python):
while True:
    A = list(input().split("\""))
    if A[0] == ".":
        break
    
    B = list(input().split("\""))

    wrong = 0
    ans = ""

    for i in range(min(len(A),len(B))):
        if i%2 == 1:
            if A[i] != B[i]:
                wrong += 1
        else:
            if A[i] != B[i]:
                wrong = 2
    if wrong == 0:
        ans = "IDENTICAL"
    elif wrong == 1:
        ans = "CLOSE"
    else:
        ans = "DIFFERENT"   
    if len(A) != len(B):
        ans = "DIFFERENT"
    print(ans)

Solution (Python):
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2,gcd
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    ans=[]
    while 1:
        s1 = input()
        if s1 == '.':
            break
        else:
            s2 = input().split('"')
            s1=s1.split('"')

            ct=0
            flag=0

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


            if flag==0:
                ans.append('IDENTICAL')
            elif flag==1:
                ans.append('CLOSE')
            else:
                ans.append('DIFFERENT')

    for x in ans:
        print(x)
if __name__ == '__main__':
    main()

Solution (Python):
import sys
import re
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def LIST(): return list(map(int, input().split()))

ans = []
while 1:
	s1 = input()
	if s1 == ".":
		break
	s2 = input()

	if s1 == s2:
		ans.append("IDENTICAL")
	else:
		if s1.count('"') != s2.count('"'):
			ans.append("DIFFERENT")

		else:
			s1 = s1.split('"')
			s2 = s2.split('"')
			cnt = 0
			for i in range(min(len(s1), len(s2))):
				if i % 2 == 0 and s1[i] != s2[i]:
					ans.append("DIFFERENT")
					break
				elif i % 2 == 1 and s1[i] != s2[i]:
					cnt += 1
					if cnt >= 2:
						ans.append("DIFFERENT")
						break
			else:
				ans.append("CLOSE")
for i in ans:
	print(i)

Solution (Python):
def parse(str):
    strs = []
    s = ""
    code = ""
    isStr = False
    for c in str:
        if c == "\"":
            if isStr:
                strs.append(s)
                s = ""
            else:
                code = code + c
            isStr = not isStr
        elif isStr:
            s = s + c
        else:
            code = code + c
    return [strs, code]

def is_close(l1, l2):
    strs1 = parse(l1)
    strs2 = parse(l2)   
    if strs1[1] != strs2[1]:
        return False
    strs1 = strs1[0]
    strs2 = strs2[0]
    reach = False
    for i in range(min(len(strs1), len(strs2))):
        if strs1[i] != strs2[i]:
            if reach:
                return False
            else:
                reach = not reach
    if len(strs1) != len(strs2):
        return False
    else:
        return reach

while True:
    l1 = input()
    if l1 == '.':
        break
    l2 = input()
    if l1 == l2:
        print("IDENTICAL")
    elif is_close(l1, l2):
        print("CLOSE")
    else:
        print("DIFFERENT")

Solution (Python):
def make(s1):
    i = 0
    l1 = []
    while i < len(s1):
        if s1[i] == '"':
            for k in range(i + 1, len(s1)):
                if s1[k] == '"':
                    l1.append((s1[i + 1:k], 1))
                    i = k + 1
                    break
        elif s1[i] == ";":
            for k in range(i, len(s1)):
                if s1[k] == ';':
                    l1.append((s1[i + 1:k],0))
                    i = k + 1
                    break
                if s1[k] == '"':
                    l1.append((s1[i + 1:k], 0))
                    i = k 
                    break
            else:
                l1.append((s1[i + 1:], 0))
                i = k + 1
        else:
            for k in range(i, len(s1)):
                if s1[k] == ';':
                    l1.append((s1[i:k], 0))
                    i = k + 1
                    break
                if s1[k] == '"':
                    l1.append((s1[i:k], 0))
                    i = k
                    break
            else:
                l1.append((s1[i:], 0))
                i = k + 1
    return l1

def main():
    s1 = input()
    s2 = input()
    l1 = make(s1)
    l2 = make(s2)
    if len(l1) != len(l2):
        print("DIFFERENT")
        return
    f = 0
    for i in range(len(l1)):
        if l1[i] != l2[i]:
            if l1[i][1] == 0:
                f += 1
            f += 1
    if f == 0:
        print("IDENTICAL")
    elif f == 1:
        print("CLOSE")
    else:
        print("DIFFERENT")



for i in range(100):
    main()

Solution (Python):
def main(s):
	if s == ".":
		return False
	ss = input()
	diffc = 0
	sl = s.split("\"")
	ssl = ss.split("\"")
	if len(sl) != len(ssl):
		print("DIFFERENT")
		return True
	for i in range(len(sl)):
		if i % 2 == 0:
			if sl[i] != ssl[i]:
				print("DIFFERENT")
				return True
		else:
			if sl[i] != ssl[i]:
				diffc += 1
	if diffc == 0:
		print("IDENTICAL")
	elif diffc == 1:
		print("CLOSE")
	else:
		print("DIFFERENT")
	return True


while main(input()):
	pass

Solution (Python):
while True:
    s1 = input()
    if s1 == ".":
        break
    s2 = input().split("\"")
    s1 = s1.split("\"")
    if len(s1) != len(s2):
        print("DIFFERENT")
    else:
        fin = False
        count = 0
        for i in range(len(s1)):
            if i%2 == 0:
                if s1[i] != s2[i]:
                    print("DIFFERENT")
                    fin = True
                    break
            else:
                if s1[i] != s2[i]:
                    count += 1
                    if count > 1:
                        print("DIFFERENT")
                        fin = True
                        break
        if not fin:
            if count == 1:
                print("CLOSE")
            elif count == 0:
                print("IDENTICAL")

Solution (Python):
ans_list = []

def solve():
    S = input()
    if S == ".":
        return "end"
    T = input()

    if S == T:
        return "IDENTICAL"

    cs = []
    ct = []

    ns = []
    nt = []

    tmp = ""
    flag = False
    for s in S:
        if s == '"':
            if flag:
                flag = False
                cs.append(tmp)
            else:
                flag = True
                ns.append(tmp)
            tmp = ""
            continue
        tmp += s
    ns.append(tmp)

    tmp = ""
    flag = False
    for t in T:
        if t == '"':
            if flag:
                flag = False
                ct.append(tmp)
            else:
                flag = True
                nt.append(tmp)
            tmp = ""
            continue
        tmp += t
    nt.append(tmp)

    if ns != nt or len(cs) != len(ct):
        return "DIFFERENT"
    
    cnt = 0
    for csi, cti in zip(cs, ct):
        if csi != cti:
            cnt += 1
    
    if cnt == 1:
        return "CLOSE"
    else:
        return "DIFFERENT"
    

while True:
    ans = solve()
    if ans == "end":
        break
    ans_list.append(ans)

for ans in ans_list:
    print(ans)

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

while True:
    s1 = input()
    if s1 == '.':
        break
    else:
        s2 = input()
        s1,s2 = s1.split('\"'),s2.split('\"')
        if len(s1) != len(s2):
            print('DIFFERENT')
        else:
            L = len(s1)
            cnt = 0
            for i in range(L):
                d1,d2 = s1[i],s2[i]
                if i%2 == 0:
                    if d1 != d2:
                        print('DIFFERENT')
                        break
                elif i%2 == 1:
                    if d1 != d2:
                        cnt += 1
            else:
                if cnt == 0:
                    print('IDENTICAL')
                elif cnt == 1:
                    print('CLOSE')
                else:
                    print('DIFFERENT')

Solution (Python):
while True:

    
    

    k1 = []
    g1 = []
    k2 = []
    g2 = []
    check=input()
    if check == ".":
        break
    strings1 = list(map(str, check.split('"')))

    strings2 = list(map(str, input().split('"')))

    nagasa1 = len(strings1)
    nagasa2 = len(strings2)

    for i in range(nagasa1):
        if i % 2 == 0:
            g1.append(strings1[i])
        else:
            k1.append(strings1[i])

    for i in range(nagasa2):
        if i % 2 == 0:
            g2.append(strings2[i])
        else:
            k2.append(strings2[i])

    lengthk1 = len(k1)
    lengthg1 = len(g1)
    lengthk2 = len(k2)
    lengthg2 = len(g2)

    points = 0

    if lengthg1 == lengthg2:
        for i in range(lengthg1):
            if g1[i] == g2[i]:
                pass
            else:
                points += 2
    else:
        points += 2

    if lengthk1 == lengthk2:
        for i in range(lengthk1):
            if k1[i] == k2[i]:
                pass
            else:
                points += 1
    else:
        if lengthk1 - lengthk2 == 1 or lengthk1 - lengthk2 == -1:
            if lengthk1 < lengthk2:
                for i in range(lengthk1):
                    if k1[i] == k2[i]:
                        pass
                    else:
                        points += 1
            else:
                for i in range(lengthk2):
                    if k1[i] == k2[i]:
                        pass
                    else:
                        points += 1
        else:
            points += 2

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

Solution (Python):
while(1):
    s = input()
    if s=='.': break
    s = list(s.split('"'))
    t = list(input().split('"'))
    if len(s) != len(t):
        print("DIFFERENT")
    else:
        cnt=0
        ss=len(s)
        for i in range(ss):
            if i%2==0 and s[i]!=t[i]:
                cnt=100
            elif i%2==1 and s[i]!=t[i]:
                cnt+=1
        if cnt==1:
            print("CLOSE")
        elif cnt==0:
            print("IDENTICAL")
        else:
            print("DIFFERENT")

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

  s1words = []
  s2words = []
  s1split = ""
  s2split = ""

  flag = False
  string = ""
  for e in s1:
    if not flag and e=='"':
      flag = True
      s1split += e
    elif flag and e=='"':
      flag = False
      s1split += e
      s1words.append(string)
      string = ""
    elif flag:
      string += e
    else:
      s1split += e

  flag = False
  string = ""
  for e in s2:
    if not flag and e=='"':
      flag = True
      s2split += e
    elif flag and e=='"':
      flag = False
      s2split += e
      s2words.append(string)
      string = ""
    elif flag:
      string += e
    else:
      s2split += e

  wrong = 0
  if len(s1words)!=len(s2words):
    print("DIFFERENT")
  else:
    for s, t in zip(s1words, s2words):
      if s!=t:
        wrong += 1
    if wrong==0 and s1split==s2split:
      print("IDENTICAL")
    elif wrong==1 and s1split==s2split:
      print("CLOSE")
    else:
      print("DIFFERENT")

Solution (Python):
while True:
  S_1 = input()
  if S_1 == '.':
    break
  S_2 = input()
  
  if S_1 == S_2:
    print("IDENTICAL")
    continue
  
  A = [0]
  B = [0]
  for i, s in enumerate(S_1):
    if s == '"':
      A.append(i)
  for i, s in enumerate(S_2):
    if s == '"':
      B.append(i)
      
  if len(A) != len(B):
    print('DIFFERENT')
    continue
  
  A.append(len(S_1))
  B.append(len(S_2))
  cnt = 0
  
  for i in range(len(A) - 1):
    if i % 2 == 0 and S_1[A[i]:A[i + 1]] != S_2[B[i]:B[i + 1]]:
      print('DIFFERENT')
      break
    if i % 2 == 1 and S_1[A[i]:A[i + 1]] != S_2[B[i]:B[i + 1]]:
      cnt += 1
  else:
      print('DIFFERENT' if cnt > 1 else 'CLOSE')

Solution (Python):
"""
与えられた二つのプログラムが完全に等しければ IDENTICAL と出力せよ．
二つのプログラム中の対応する文字列定数一つだけが異なるならば CLOSE と出力せよ．
それ以外の場合，DIFFERENT と出力せよ．
"""
import re


while True:
    s1 = str(input())
    if s1 == '.':
        break
    s2 = str(input())

    moziretsuteisu_s1 = re.findall("\".*?\"", s1)
    moziretsuteisu_s2 = re.findall("\".*?\"", s2)

    new_s1 = re.sub("\".*?\"", " ", s1)
    new_s2 = re.sub("\".*?\"", " ", s2)

    cnt = 0
    if len(moziretsuteisu_s1) != len(moziretsuteisu_s2):
        cnt = 2
    else:
        for x, y in zip(moziretsuteisu_s1, moziretsuteisu_s2):
            if x != y:
                cnt += 1

    if s1 == s2:
        print("IDENTICAL")
    elif cnt == 1 and new_s1 == new_s2:
        print("CLOSE")
    else:
        print("DIFFERENT")

Solution (Python):
while True:
    s = input().split('"')
    if s == ['.']:
        exit()
    t = input().split('"')

    is_diff = False
    is_close = 0
    if len(s) == len(t):
        for i in range(len(s)):
            if i % 2 == 0:
                if s[i] != t[i]:
                    is_diff = True
            else:
                if s[i] != t[i]:
                    is_close += 1
    else:
        is_diff = True

    if is_diff:
        print('DIFFERENT')
    elif is_close == 0:
        print('IDENTICAL')
    else:
        print(['CLOSE', 'DIFFERENT'][is_close > 1])

Solution (Python):


import re
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def solve():
    s1 = input()[:-1]
    if s1 == ".":
        exit()
    else:
        s2 = input()[:-1]

    s1_split = s1.split('"')
    s2_split = s2.split('"')
    diff_word = []
    ans = "DIFFERENT"
    for a, b in zip(s1_split, s2_split):
        if a == b:
            continue
        else:
            diff_word.append(a)
    if len(s1_split) == len(s2_split):
        if len(diff_word) == 0:
            ans = "IDENTICAL"
        elif len(diff_word) == 1:
            pattern = '\"(.*?)\"'
            reg = re.compile(pattern)
            str_const = reg.findall(s1)
            if diff_word[0] in str_const:
                ans = "CLOSE"
    print(ans)


while True:
    solve()

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

    inqrt1 = []
    outqrt1 = []

    nowqrt = False
    stringin = ""
    stringout = ""
    count = 0
    for char in data:
        if nowqrt:
            if char != '"' and count != len(data) - 1:
                stringin += char
            else:
                if count == len(data) - 1: stringin += char
                inqrt1.append(stringin)
                stringin = ""
                nowqrt = False
        else:
            if char != '"' and count != len(data) - 1:
                stringout += char
            else:
                if count == len(data) - 1: stringout += char
                nowqrt = True
                outqrt1.append(stringout)
                stringout = ""
        count += 1

    data = input()
    inqrt2 = []
    outqrt2 = []

    nowqrt = False
    stringin = ""
    stringout = ""
    count = 0
    for char in data:
        if nowqrt:
            if char != '"' and count != len(data) - 1:
                stringin += char
            else:
                if count == len(data) - 1: stringin += char
                inqrt2.append(stringin)
                stringin = ""
                nowqrt = False
        else:
            if char != '"' and count != len(data) - 1:
                stringout += char
            else:
                if count == len(data) - 1: stringout += char
                nowqrt = True
                outqrt2.append(stringout)
                stringout = ""
        count += 1

    difcount = 0
    if len(inqrt1) != len(inqrt2) or outqrt1 != outqrt2:
        print("DIFFERENT")
    elif inqrt1 == inqrt2:
        print("IDENTICAL")
    else:
        for i in range(len(inqrt1)):
            if inqrt1[i] != inqrt2[i]: difcount += 1
        if difcount <= 1: print("CLOSE")
        else: print("DIFFERENT")

Solution (Python):
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'

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    def f(s,t):
        if s == t:
            return 'IDENTICAL'
        sa = s.split('"')
        ta = t.split('"')
        if len(sa) != len(ta):
            return 'DIFFERENT'
        ef = False
        for i in range(len(sa)):
            si = sa[i]
            ti = ta[i]
            if si == ti:
                continue
            if i % 2 == 0 or ef:
                return 'DIFFERENT'
            ef = True
        return 'CLOSE'

    while 1:
        n = S()
        if n == '.':
            break
        rr.append(f(n,S()))

    return '\n'.join(map(str,rr))


print(main())

Solution (Python):
def solve(s1,s2):
    if s1 == s2:
        return 0

    l1,l2 = s1.split('"'),s2.split('"')
    if len(l1) != len(l2):
        return 1

    ct = 0
    for i in range(len(l1)):
        if i%2 == 0:
            if l1[i] != l2[i]:
                return 1
        else:
            if l1[i] != l2[i]:
                ct += 1
            if ct > 1:
                return 1
    return 2

def main():
    ans = ['IDENTICAL', 'DIFFERENT', 'CLOSE']
    while True:
        s1 = input()
        if s1 == '.':
            return
        s2 = input()
        print(ans[solve(s1,s2)])

if __name__ == '__main__':
    main()

Solution (Python):
def is_same(s1, s2):
  sp1 = s1.split("\"")
  sp2 = s2.split("\"")
  if len(sp1) != len(sp2):
    return 2
  
  count = 0
  for i in range(len(sp1)):
    if i % 2 == 0:
      if sp1[i] != sp2[i]:
        return 2
    else:
      if sp1[i] != sp2[i]:
        count += 1
        if count >= 2:
          return 2
  return count

while True:
  s1 = input()
  if s1 == ".":
    break
  s2 = input()
  result = is_same(s1, s2)
  if result == 0:
    print("IDENTICAL")
  elif result == 1:
    print("CLOSE")
  else:
    print("DIFFERENT")

Solution (Python):
while 1:
    a = input()
    if a == ".":
        break
    b = input()
    if a == b:
        print("IDENTICAL")
    else:
        a = a.split("\"")
        b = b.split("\"")
        if len(a) != len(b):
            print("DIFFERENT")
        else:
            key = [0,0]
            for i in range(len(a)):
                if a[i] != b[i]:
                    key[i%2] += 1
            print("CLOSE" if key == [0,1] else "DIFFERENT")