Find what is the distance for a given string to its closest palindrome of the same length.
For this task I decided to give the characters further away from the string's center more weight (think of it as contributing more torque), proportional to their distance to the center.
Let's define the palindrome distance for a string \$s\$ as the sum of all products of the absolute difference of the corresponding pairs, equally spaced from the string's centre, and their distance to the center.
\$D_p=\displaystyle\sum_{i=1}^{d}\left(d-i+1\right)|s_i-s_{l-i+1}|\$
where \$l\$ is the length of \$s\$ and \$d = \left\lfloor\frac{l}{2}\right\rfloor\$
Since the middle character doesn't contribute anything to the sum, \$d\$ for strings with odd length \$l\$ is equal to \$d\$ for strings with length \$l-1\$.
Task
Given string \$s\$ with length > 1 find \$D_p(s)\$
Input
One of the following:
- a string;
- a list of characters;
- a list of numbers.
Output
An integer - the palindrome distance of the input string.
Test cases
"aa" -> 0
"bab" -> 0
"abca" -> 1
"cbade" -> 6
"hello" -> 21
"code-golf" -> 45
"neveroddoreven" -> 0
"Neveroddoreven" -> 224
Winning criteria
The shortest code in bytes in every language wins.