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 <stdio.h>
#include <string.h>
char a[2000010];
int f(int s1,int e1,int s2,int e2){
int cnt=0;
while(s1<=e1){
if(a[s1]==a[s2])++s1,++s2;
else{
if(cnt)return 0;
++s2,++cnt;
}
}
return 1;
}
int main()
{
int i,n,flag=0;
scanf("%d",&n);
if(n%2==0){
puts("NOT POSSIBLE");
return 0;
}
scanf("%s",a+1);
if(!strncmp(a+n/2+2,a+1,n/2)){
for(i=1;i<=n/2;++i)printf("%c",a[i]);
return 0;
}
if(f(1,n/2,n/2+1,n))flag=1;
if(f(n/2+2,n,1,n/2+1)){
if(flag){
puts("NOT UNIQUE");
return 0;
}
flag=2;
}
if(!flag)puts("NOT POSSIBLE");
if(flag==1)for(i=1;i<=n/2;++i)printf("%c",a[i]);
if(flag==2)for(i=n/2+2;i<=n;++i)printf("%c",a[i]);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |