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



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
.


Sample output:
IDENTICAL
CLOSE
DIFFERENT
CLOSE
DIFFERENT
DIFFERENT
DIFFERENT
CLOSE
DIFFERENT

Submission status: Wrong Answer

Solution code:
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] == b[l+idx_dif:i+idx_dif]):
                        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] != b[l+idx_dif:j]):
                                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")

Submission status: Wrong Answer

Solution code:
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 == 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")

Submission status: Wrong Answer

Solution code:
#-*- coding:utf-8 -*-

ans=[]

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

    if(s1==s2):
        ans.append("IDENTICAL")
        continue

    if(len(s1)>len(s2)):
        size=len(s1)
    else:
        size=len(s2)

    cnt=0
    d1=0
    d2=0
    for i in range(size):
        if i+d1>len(s1)-1 or i+d2>len(s2)-1:
            break
        if s1[i+d1]!=s2[i+d2]:
            ans.append("DIFFERENT")
            break
        if len(s1)==1 or len(s2)==1:
            ans.append("DIFFERENT")
            break
        if s1[i+d1]=="\"":
            a1=""
            a2=""
            d1+=1
            d2+=1
            flag=False
            while True:
                if i+d1>=len(s1)-1:
                    ans.append("DIFFERENT")
                    flag=True
                    break
                if s1[i+d1] =="\"":
                    break
                a1=a1+s1[i+d1]
                d1+=1
            while True:
                if i+d1==len(s1)-1:
                    break
                if i+d2==len(s2)-1:
                    ans.append("DIFFERENT")
                    flag=True
                    break
                if s2[i+d2]=="\"" or i+d1>=len(s1)-1 or i+d2>=len(s2)-1:
                    break
                a2=a2+s2[i+d2]
                d2+=1
            if a1!=a2:
                cnt+=1
    if cnt==1:
        ans.append("CLOSE")
    elif cnt>1 and  not flag:
        ans.append("DIFFERENT")
            
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
#16D8101014F 久留米 竜之介 Python3
#a=[]
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("DIFFELENT")
	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

Submission status: Wrong Answer

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

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

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

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

        if not isTmp:
            if i % 2 == 0:
                if s1[i] != s2[i]:
                    print("DIFFERENT");
                    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");
                    break
            if i+1 % 2 == 1:
                if s1[i] != s2[i]:
                    count += 1

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

Submission status: Wrong Answer

Solution code:
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())
    print(a)
    print(b)
    res = 0
    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:
                if res == 1:
                    break
                res += 1
    if res == 0:
        print("IDENTICAL")
    elif res == 1:
        print("CLOSE")
    else:
        print("DIFFERENT")

Submission status: Wrong Answer

Solution code:
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
    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:
                if res == 1:
                    break
                res += 1
    if res == 0:
        print("IDENTICAL")
    elif res == 1:
        print("CLOSE")
    else:
        print("DIFFERENT")

Submission status: Wrong Answer

Solution code:
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())
    print(a)
    print(b)
    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")

Submission status: Time Limit Exceeded

Solution code:
s1 = list(str(input()))
while s1!= '.':
    s2 = list(str(input()))
    if s1 == s2:
        print("IDENTICAL")
    else:
        tmp1 = 0
        tmp2 = 0
        key = 0
        while tmp1 != len(s1)-1 or tmp2 != len(s2)-1:
            str1 = []
            str2 = []
            str3 = []
            str4 = []
            n1 = 0
            n2 = 0
            for i in range(tmp1, len(s1)):
                if s1[i] != '"':
                    str1.append(s1[i])
                    tmp1 = i
                if s1[i] == '"':
                    n1 = 1
                    j = i
                    for k in range(j+1, len(s1)):
                        if s1[k] == '"':
                            tmp1 = k+1
                            break
                        str3.append(s1[k])
                if n1 == 1:
                    break

            for i in range(tmp2, len(s2)):
                if s2[i] != '"':
                    str2.append(s2[i])
                    tmp2 = i
                if s2[i] == '"':
                    n2 = 1
                    j = i
                    for k in range(j+1, len(s2)):
                        if s2[k] == '"':
                            tmp2 = k+1
                            break
                        str4.append(s2[k])
                if n2 == 1:
                    break
            print(str1, str2, str3, str4)
            if str3 == str4:
                pass
            elif str3 != str4:
                key += 1
            if str1 != str2 or key >= 2:
                print("DIFFERENT")
                break

        if key == 1 and str1 == str2:
            print("CLOSE")
    s1 = list(str(input()))

Submission status: Time Limit Exceeded

Solution code:
s1 = list(str(input()))
while s1!= '.':
    s2 = list(str(input()))
    if s1 == s2:
        print("IDENTICAL")
    else:
        tmp1 = 0
        tmp2 = 0
        key = 0
        while tmp1 != len(s1)-1 or tmp2 != len(s2)-1:
            str1 = []
            str2 = []
            str3 = []
            str4 = []
            n1 = 0
            n2 = 0
            for i in range(tmp1, len(s1)):
                if s1[i] != '"':
                    str1.append(s1[i])
                    tmp1 = i
                if s1[i] == '"':
                    n1 = 1
                    j = i
                    for k in range(j+1, len(s1)):
                        if s1[k] == '"':
                            tmp1 = k+1
                            break
                        str3.append(s1[k])
                if n1 == 1:
                    break

            for i in range(tmp2, len(s2)):
                if s2[i] != '"':
                    str2.append(s2[i])
                    tmp2 = i
                if s2[i] == '"':
                    n2 = 1
                    j = i
                    for k in range(j+1, len(s2)):
                        if s2[k] == '"':
                            tmp2 = k+1
                            break
                        str4.append(s2[k])
                if n2 == 1:
                    break
            if str3 == str4:
                pass
            elif str3 != str4:
                key += 1
            if str1 != str2 or key >= 2:
                print("DIFFERENT")
                break

        if key == 1 and str1 == str2:
            print("CLOSE")
    s1 = list(str(input()))

Submission status: Accepted

Solution code:
# AOJ 1617: Almost Identical Programs
# Python3 2018.7.13 bal4u

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])

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# from sys import exit

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")

Submission status: Accepted

Solution code:
while (True):
    s1=input()
    if (s1=="."):
        break
    s2=input()
    l1=s1.split("\"")
    l2=s2.split("\"")
   #print(l1,l2)
    if (len(l1)!=len(l2)):
        print("DIFFERENT")
        continue
    error=0
    for i in range(len(l1)):
        #print(l1,l2,i)
        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]))):
            #   print(l1[i][j],l2[i][j])
                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")

Submission status: Accepted

Solution code:
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)])

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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]])

Submission status: Accepted

Solution code:
#!/usr/bin/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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
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')

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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:]

Submission status: Accepted

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

    jdg = 1
    cnt_d = 0
    #print(s1)
    #print(s2)

    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")

Submission status: Accepted

Solution code:
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
#    print(s1,s2)
    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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
#coading Shit_JIS

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")

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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]])