Almost Identical Programs
InterviewTime limit2sMemory limit512 MB
Given two program strings, decide whether they are identical, differ only in one string literal at the same position, or are otherwise different.
- Level
Medium4 of 10
- Topics
- String, Implementation, Two pointers
- Solved
- No attempts yet
Problem
The programming contest named Concours de Programmation Comtemporaine Interuniversitaire (CPCI) judges submissions much like the ICPC does. A contestant has to submit correct outputs for two different inputs before a solution counts as accepted. Each submission also has to include the program that produced the output. A pair of submissions counts as a correct solution only when both outputs are correct and the two submissions include an identical program.
Many contestants still put a different version of their program into the second submission. They modify a single string literal that holds the input file name so the program reads the other input file. The organizers of CPCI want to show a special error message for such close submissions so that contestants see what went wrong. Your task is to detect them.
Input
The input consists of at most 100 datasets. Each dataset has the following format.
s1
s2
Each of s1 and s2 is a string written on its own line, with a length between 1 and 200, inclusive. They are the first and the second submitted program, in that order. A program consists of lowercase letters (a, b, ..., z), uppercase letters (A, B, ..., Z), digits (0, 1, ..., 9), double quotes ("), and semicolons (;). The number of double quotes in a program is always even.
The end of the input is marked by a line containing a single period (.).
Output
For each dataset, print the judge result on one line.
If the two programs are identical, print IDENTICAL. If they differ in exactly one corresponding string literal and agree everywhere else, 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.