#include <bits/stdc++.h>
using namespace std;
int main () {
int n; cin >> n;
string u, aux3 = ""; cin >> u;
int resp = 0;
if(n%2 == 0) {
cout << "NOT POSSIBLE";
return 0;
}
for(int i = 0; i < n; i++) {
string aux = "";
for(int j = 0; j < n; j++) {
if(j == i) continue;
aux += u[j];
}
string aux2 = "";
for(int k = 0; k < (n-1)/2; k++) {
if(aux[k] == aux[k+(n-1)/2]) aux2 += aux[k];
}
if(aux2.size() == (n-1)/2) {
resp++;
aux3 = aux2;
}
}
if(resp > 1) cout << "NOT UNIQUE";
else if(aux3 == "") cout << "NOT POSSIBLE";
else cout << aux3;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |