You will be given a positive integer as input.
The integer is the board of a seesaw.
Th integer will not have leading zeroes. You may take this input however you like.
Your task is to output the location of the pivot point of this seesaw, such that the board would balance.
A board balances if the moments on each side are equal in magnitude. A moment is calculated by multiplying the force by the distance from the pivot point. In this case, the force is equal to the digit.
For the integer
100 with a pivot point below the first
0, the moment on the left is 1x1=1. The moment on the right is 0x1=0. If the pivot point was below the second
0, the moment on the left would be 2x1=2 (because the
1 is now 2 away from the pivot).
For example, for the integer
31532 the pivot goes underneath the number 5. This is because the moments on the left are 3x2 + 1x1 = 7 and on the right the moments are 3x1 + 2x2 = 7.
The output for this integer is
3 because the pivot goes underneath the 3rd digit.
If the integer cannot be balanced, your code does not have to do anything - it can hang, error, output nothing - whatever you want.
Note that a pivot cannot go between two numbers. The pivot location must be an integer.
31532 -> 3 101 -> 2 231592 -> 4 8900311672 -> 5
Standard loopholes apply, this is code golf so shortest answer wins.