Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		s := io.NextLine()
		if s == "." {
			break
		}
		t := io.NextLine()
		if s == t {
			io.Println("IDENTICAL")
			continue
		}
		ss := strings.Split(s, "\"")
		tt := strings.Split(t, "\"")
		if len(ss) != len(tt) {
			io.Println("DIFFERENT")
			continue
		}
		cnt := 0
		for i := 0; i < len(ss); i++ {
			if i%2 == 0 {
				if ss[i] != tt[i] {
					cnt = -1
					break
				}
			} else {
				if ss[i] != tt[i] {
					cnt++
				}
			}
		}
		if cnt > 1 || cnt == -1 {
			io.Println("DIFFERENT")
		} else {
			io.Println("CLOSE")
		}
	}
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
    string s1;
    while(cin >> s1, s1 != ".") {
        string s2; cin >> s2;
        const int n = s1.size(), m = s2.size();
        int cnt = 0;
        bool in_str = false;
        int i = 0, j = 0;
        while(i < n && j < m) {
            if(s1[i] != s2[j]) {
                if(!in_str) {
                    cnt = 2;
                    break;
                }
                cnt += 1;
                while(i < n && s1[i] != '\"') i++;
                while(j < m && s2[j] != '\"') j++;
                i = i + 1; j = j + 1;
            } else {
                in_str ^= s1[i] == '\"';
                i++, j++;
            }
        }
        if(i != n || j != m || cnt >= 2) {
            cout << "DIFFERENT" << endl;
        } else if(cnt == 1) {
            cout << "CLOSE" << endl;
        } else {
            cout << "IDENTICAL" << endl;
        }
    }
}

C++: #include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second

int main(){
	string s1,s2;

	while(true) {
		cin >> s1;
		if(s1 == ".")
			break;
		cin >> s2;
		if(s1 == s2) {
			cout << "IDENTICAL" << endl;
			continue;
		}

		string t1,t2;

		t1 = t2 = "";
		ll cou1 = 0,cou2 = 0;
		vector<string> u1,u2;

		REP(i,s1.size()) {
			if(s1[i] == '\"') {
				i++;
				string u = "";
				while(s1[i] != '\"'){
					u.push_back(s1[i]);
					i++;
				}
				u1.pb(u);
				cou1++;
			}
			if(i < s1.size()) 
				t1.push_back(s1[i]);
		}
		REP(i,s2.size()) {
			if(s2[i] == '\"') {
				i++;
				string u = "";
				while(s2[i] != '\"'){
					u.push_back(s2[i]);
					i++;
				}
				u2.pb(u);
				cou2++;
			}
			if(i < s2.size()) 
				t2.push_back(s2[i]);
		}
		if(t1 != t2 || cou1 != cou2) {
			cout << "DIFFERENT" << endl;
			continue;
		}
		ll cou = 0;

		REP(i,u1.size()) {
			if(u1[i] != u2[i]) 
				cou++;
		}

		if(cou > 1) {
			cout << "DIFFERENT" << endl;
		}else {
			cout << "CLOSE" << endl;
		}

	}
	return 0;
}

C++: /*  -*- coding: utf-8 -*-
 *
 * 1617.cc: Almost Identical Programs
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

typedef pair<int,string> pis;

enum { PRG, STR, EOL };

/* global variables */

char s0[256], s1[256];

/* subroutines */

pis next_literal(char *(&cpt)) {
  if (*cpt) {
    if (*cpt == '"') { // string literal
      cpt++; // '"'
      string s;
      while (*cpt != '"') s += *(cpt++);
      cpt++; // '"'
      return pis(STR, s);
    }

    // program
    string s(*(cpt++), 1);
    return pis(PRG, s);
  }
  return pis(EOL, string());
}

/* main */

int main() {
  while (scanf("%s", s0) == 1 && strcmp(s0, ".") != 0) {
    scanf("%s", s1);

    int pdf = 0, ldf = 0;
    char *cpt0 = s0, *cpt1 = s1;
    while (! pdf && ldf <= 1 && *cpt0 && *cpt1) {
      pis l0 = next_literal(cpt0);
      pis l1 = next_literal(cpt1);

      if (l0.first != l1.first)
	pdf++;
      else if (l0.first == PRG && l0.second != l1.second)
	pdf++;
      else if (l0.first == STR && l0.second != l1.second)
	ldf++;
    }
    if (*cpt0 != *cpt1) pdf++;

    if (pdf > 0 || ldf > 1) puts("DIFFERENT");
    else if (ldf > 0) puts("CLOSE");
    else puts("IDENTICAL");
  }
  return 0;
}