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 <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

enum State { ide, clo, dif };

State Solve(std::string a, std::string b) {
  if (a == b) {
    return ide;
  }

  std::vector<std::string> const_a, const_b, code_a, code_b;
  bool perse_const = false;
  int begin_pos    = 0;

  for (int i = 0; i < a.size(); i++) {
    if (perse_const) {
      if (a[i] == '"') {
        std::string curr_const;
        for (int j = begin_pos; j < i; j++) {
          curr_const += a[j];
        }
        const_a.push_back(curr_const);
        begin_pos   = i + 1;
        perse_const = false;
      }

    } else {
      if (a[i] == '"' || i == a.size() - 1) {
        if (i == a.size() - 1) i++;
        std::string curr_code;
        for (int j = begin_pos; j < i; j++) {
          curr_code += a[j];
        }
        code_a.push_back(curr_code);
        begin_pos   = i + 1;
        perse_const = true;
      }
    }
  }

  begin_pos   = 0;
  perse_const = false;

  for (int i = 0; i < b.size(); i++) {
    if (perse_const) {
      if (b[i] == '"') {
        std::string curr_const;
        for (int j = begin_pos; j < i; j++) {
          curr_const += b[j];
        }
        const_b.push_back(curr_const);
        begin_pos   = i + 1;
        perse_const = false;
      }
    } else {
      if (b[i] == '"' || i == b.size() - 1) {
        if (i == b.size() - 1) i++;
        std::string curr_code;
        for (int j = begin_pos; j < i; j++) {
          curr_code += b[j];
        }
        code_b.push_back(curr_code);
        begin_pos   = i + 1;
        perse_const = true;
      }
    }
  }

  if (const_a.size() != const_b.size()) {
    // cerr << "\033[93m"
    //      << "size is wrong"
    //      << "\033[m" << endl;
    return dif;
  }

  int count = 0;
  for (int i = 0; i < const_a.size(); i++) {
    // cerr << "\033[93m" << const_a[i] << "\t" << const_b[i] << "\033[m" <<
    // endl;
    if (const_a[i] != const_b[i]) {
      count++;
    }
  }
  if (count == 1) {
    for (int i = 0; i < code_a.size(); i++) {
      // cerr << "\033[93m" << code_a[i] << "\t" << code_b[i] << "\033[m" <<
      // endl;
      if (code_a[i] != code_b[i]) {
        return dif;
      }
    }
    return clo;
  } else {
    return dif;
  }
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  while (1) {
    std::string a, b;
    cin >> a;
    if (a == ".") break;
    cin >> b;
    State state = Solve(a, b);
    if (state == ide) {
      cout << "IDENTICAL";
    } else if (state == clo) {
      cout << "CLOSE";
    } else {
      cout << "DIFFERENT";
    }
    cout << endl;
  }

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
char stra[1000], strb[1000];
int lena, lenb;
stack<char> s1, s2;

int main()
{
	freopen("a.in", "r", stdin);
	while(true)
	{
		scanf("%s", stra);
		lena = strlen(stra);
		if(lena == 1 && stra[0] == '.')
			break;
		while(!s1.empty())
			s1.pop();
		while(!s2.empty())
			s2.pop();
		scanf("%s", strb);
		lenb = strlen(strb);
		int posa = 0, posb = 0;
		int cnt = 0;
		bool ff = false;
		while(true)
		{
			if(posa >= lena && posb >= lenb)
			{
				break;
			}
			if(stra[posa] != strb[posb])
			{
				printf("DIFFERENT\n");
				ff = true;
				break;
			}
			if(stra[posa] == '\"')
			{
				bool fg = false;
				posa ++, posb ++;
				while(true)
				{
					if(stra[posa] == strb[posb] && strb[posb] == '\"')
					{
//						posa ++, posb ++;
						break;
					}
					if(stra[posa] == strb[posb])
					{
						posa ++, posb ++;
						continue;
					}
					else
					{
						cnt++;
						for(posa; posa < lena && stra[posa] != '\"'; posa++);
						for(posb; posb < lenb && strb[posb] != '\"'; posb++);
						fg = true;
						break;
					}
				}
				if(fg && cnt == 2)
				{
					printf("DIFFERENT\n");
					ff = true;
					break;
				}
			}
			posa ++, posb ++;
		}
		if(cnt == 1 && !ff)
			printf("CLOSE\n");
		else if(!ff)
			printf("IDENTICAL\n");
	}
	return 0;
}