This problem requires little imagination, and here is the solution:
Assume The original shaft length is L. The center of gravity originally was L/2 from the left, as you cut 40 cm from end, the shaft length is reduced by 40 cm, assume the final shaft length is L' = L - 40. In that case the center of gravity for the shaft would be L'/2 = ( L-40/2) = L/2 -20.
comparing the location of the center of gravity before and after the cut
Before = L/2 to the left
After = L/2 - 20 to the left and therefore the center of gravity moves 20 cm to the left