Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 committed Aug 21, 2022
1 parent b91b5c4 commit 5b29baf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Round E/matching_palindrome.py3
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ def is_palindrome(P, left, right):
def matching_palindrome():
N = int(input())
P = input()
for l in range(1, len(P)):
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):
return P[:l]
return P
break
return P[:l]

for case in range(int(input())):
print('Case #%d: %s' % (case+1, matching_palindrome()))

0 comments on commit 5b29baf

Please sign in to comment.