This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,i,cnt,ans;
string t,u,s;
bool check(string s){
ll n=s.size(),i;
for(i=0;i<n/2;i++){
if(s[i]!=s[i+n/2]) return 0;
}
return 1;
}
int main(){
cin >> n >> u;
if(n%2==0){
cout << "NOT POSSIBLE";
return 0;
}
for(i=0;i<n;i++){
t=u;
t.erase(t.begin()+i);
if(check(t)){
ans=i;
cnt++;
s=t;
}
}
if(cnt==0) cout << "NOT POSSIBLE";
else if(cnt>1) cout << "NOT UNIQUE";
else{
for(i=0;i<n/2;i++) cout << s[i];
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |