Skip to content

Commit 14cfd2f

Browse files
authored
Update longest-chunked-palindrome-decomposition.py
1 parent 8ce9672 commit 14cfd2f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Python/longest-chunked-palindrome-decomposition.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ def compare(text, l, s1, s2):
1717
MOD = 10**9+7
1818
D = 26
1919
result = 0
20-
l, left, right, pow_D = 0, 0, 0, 1
20+
left, right, l, pow_D = 0, 0, 0, 1
2121
for i in xrange(len(text)):
2222
left = (D*left + (ord(text[i])-ord('a'))) % MOD
2323
right = (pow_D*(ord(text[-1-i])-ord('a')) + right) % MOD
2424
l += 1
2525
pow_D = (pow_D*D) % MOD
2626
if left == right and compare(text, l, i-l+1, len(text)-1-i):
2727
result += 1
28-
l, left, right, pow_D = 0, 0, 0, 1
28+
left, right, l, pow_D = 0, 0, 0, 1
2929
return result

0 commit comments

Comments
 (0)