Skip to main content
2 of 3
I understand why now, thanks to Fatalize in chat
DLosc
  • 40.7k
  • 6
  • 87
  • 142

Brachylog, 10 bytes

↔?ḍt↰+₁|∧0 

Try it online!

Alternate 10-byte solution: ↔?ḍt↰+₁.∨0 (Try it online!)

Explanation

↔?ḍt↰+₁|∧0 ↔ The input reversed ? is the same as the input ḍ Split into two halves t Take the second half (which is the longer one if they aren't the same) ↰ Recurse +₁ Add 1 to the result of the recursive call | If the preceding part failed (because the input isn't a palindrome): ∧ Break unification with the input 0 and set the output to 0 
DLosc
  • 40.7k
  • 6
  • 87
  • 142