Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 committed Aug 22, 2022
1 parent 5b29baf commit 68ec92f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions Round E/matching_palindrome.py3
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ def is_palindrome(P, left, right):
def matching_palindrome():
N = int(input())
P = input()
for l in range(1, len(P)+1):
if len(P)%l:
continue
if is_palindrome(P, 0, l-1) and is_palindrome(P, l, len(P)-1):
break
l = next(l for l in range(1, len(P)+1) if len(P)%l == 0 and is_palindrome(P, 0, l-1) and is_palindrome(P, l, len(P)-1))
return P[:l]

for case in range(int(input())):
Expand Down

0 comments on commit 68ec92f

Please sign in to comment.