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>
using namespace std;
int main()
{
int n;
string s;
cin >>n>>s;
int cnt = 0 ;
string ans = "" ;
for(int i=0;i<n;i++){
string s1 = "" ;
for(int j=0;j<n;j++){
if(i == j)
continue ;
else{
s1 += s[j] ;
}
}
int k = n - 1;
if(k % 2 == 1){
continue ;
}
bool is = 1 ;
string q = "" ;
for(int i = 0 ; i < k / 2 ; i++){
if(s1[i] != s1[i + k / 2]){
is = 0 ;
}
q += s1[i] ;
}
if(is == 1){
cnt++ ;
ans = q ;
}
}
if(cnt == 0){
cout << "NOT POSSIBLE" << endl ;
}
else if(cnt == 1){
cout << ans << endl ;
}
else{
cout << "NOT UNIQUE" << endl ;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |