#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll n;
string s;
cin >> n >> s;
bool check = false;
string ans = "";
for (int i = 0; i < n; i++) {
string x = "";
for (int j = 0; j < n; j++) {
if (j != i) {
x += s[j];
}
}
if (x.substr(0, (n - 1) / 2) == x.substr((n - 1) / 2)) {
if (check) {
cout << "NOT UNIQUE\n";
return 0;
}
check = true;
ans = x.substr(0, (n - 1) / 2);
}
}
if (check) {
cout << ans << "\n";
} else {
cout << "NOT POSSIBLE\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |