#include<bits/stdc++.h>
using namespace std;
string test(string a, string b) {
    string f;
    int i=0, j=0;
    while (i<a.size() && i+j<b.size()) {
        if (a[i]!=b[i+j]) j++;
        else { f.push_back(a[i++]); }
    } return f;
}
int main() {
    cin.tie(0)->sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    if (n%2==0) { cout << "NOT POSSIBLE"; return 0; }
    string first=test(s.substr(0, n/2), s.substr(n/2));
    string second=test(s.substr(n/2+1), s.substr(0, n/2+1));
    if (first.length()==n/2&&second.length()==n/2) cout << "NOT UNIQUE";
    else if (first.length()==n/2) cout << first;
    else if (second.length()==n/2) cout << second;
    else cout << "NOT POSSIBLE";
    return 0;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |