This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline().strip()
ans = ""
count = 0
def is_permutation(s1, s2):
return s1==s2
for i in range(1, n + 1):
temp = s[:(i - 1)] + s[i:]
if is_permutation(temp[:n//2], temp[n//2:]):
count += 1
ans = temp[:n//2]
if count > 1:
break
if count == 0:
print("NOT POSSIBLE")
elif count == 1:
print(ans)
else:
print("NOT UNIQUE")
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |