-
-
Save arukuka/d5d669476e1c3623c3faa72aee468fae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
using namespace std; | |
int main() { | |
string s1, s2; | |
while (cin >> s1, s1 != ".") { | |
cin >> s2; | |
if (s1[s1.size() - 1] != s2[s2.size() - 1]) { | |
cout << "DIFFERENT" << endl; | |
continue; | |
} | |
int q1 = 0; | |
for (int i = 0; i < s1.size(); i++) { | |
if (s1[i] == '"') { | |
q1++; | |
} | |
} | |
int q2 = 0; | |
for (int i = 0; i < s2.size(); i++) { | |
if (s2[i] == '"') { | |
q2++; | |
} | |
} | |
if (q1 != q2) { | |
cout << "DIFFERENT" << endl; | |
continue; | |
} | |
int dif = 0; | |
int i = 0; | |
int j = 0; | |
while (i < s1.size() && j < s2.size()) { | |
if (s1[i] != s2[j]) { | |
dif = 2; | |
break; | |
} | |
if (s1[i] == '"') { | |
i++; | |
string sc1; | |
while (s1[i] != '"') { | |
sc1 += s1[i]; | |
i++; | |
} | |
j++; | |
string sc2; | |
while (s2[j] != '"') { | |
sc2 += s2[j]; | |
j++; | |
} | |
if (sc1 != sc2) { | |
dif++; | |
} | |
} | |
i++; | |
j++; | |
} | |
if (dif == 0) { | |
cout << "IDENTICAL" << endl; | |
} else if (dif == 1) { | |
cout << "CLOSE" << endl; | |
} else { | |
cout << "DIFFERENT" << endl; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment