#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#define int unsigned long long
#define re register int
#define il inline
il int read()
{
int x=0,f=1;char ch=getchar();
while(!isdigit(ch)&&ch!='-')ch=getchar();
if(ch=='-')f=-1,ch=getchar();
while(isdigit(ch))x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
return x*f;
}
il void print(int x)
{
if(x<0)putchar('-'),x=-x;
if(x/10)print(x/10);
putchar(x%10+'0');
}
const int N=2e6+5;
int n,ans,h[N],pre[N]={1},flag;
char s[N];
il int check(int l,int r){if(l>r)return 0;return h[r]-h[l-1]*pre[r-l+1];}
il int del(int l,int r,int x){return check(l,x-1)*pre[r-x]+check(x+1,r);}
signed main()
{
n=read();scanf("%s",s+1);
if(!n&1){puts("NOT POSSIBLE");return 0;}
for(re i=1;i<=n;i++)h[i]=h[i-1]*26+s[i]-'A',pre[i]=pre[i-1]*26;
for(re i=1;i<=n/2+1;i++)if(check(n/2+2,n)==del(1,n/2+1,i)){flag=1;break;}
for(re i=n/2+2;i<=n;i++)
if(check(1,n/2)==del(n/2+1,n,i))
{
if(flag==1&&check(1,n/2)!=check(n/2+2,n)){puts("NOT UNIQUE");return 0;}//这里
else if(flag==0)flag=2;break;//这里
}
if(!flag){puts("NOT POSSIBLE");return 0;}
if(flag==1)for(re i=n/2+2;i<=n;i++)putchar(s[i]);
else if(flag==2)for(re i=1;i<=n/2;i++)putchar(s[i]);
else puts("NOT POSSIBLE");
return 0;
}
CE原因
/tmp/compiler_shutndsp/src: 在函数‘int main()’中:
/tmp/compiler_shutndsp/src:37:3: 警告:this ‘else’ clause does not guard... [-Wmisleading-indentation]
else if(flag==0)flag=2;break;
^~~~
/tmp/compiler_shutndsp/src:37:26: 附注:...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
else if(flag==0)flag=2;break;