B, when the spring exceeds its original length, A is pulled to the right and begins to accelerate; B is pulled to the left and begins to decelerate; when the two speeds reach the same, A continues to accelerate and B continues to decelerate; A's speed exceeds B's and the spring shortens. So the spring is longest when both have the same speed. Right.
C. When the spring is shortened from its longest point until it returns to its original length, A always accelerates and B always decelerates. If AB has equal mass, mechanical energy is conserved throughout. Then at the first original length, A is at rest and B is in motion; at the second original length, A is in motion and B is at rest. So C is not correct.
D, the third time the original length is restored, A is only at rest, compression to the shortest, A's speed is not 0, so D is not correct.
Choose B.