Work doneis defined as the product of the displacement of an object or particle and the force component along the direction of the object's movement.
The work done by a force can be defined as the product of the displacement of an object and the component of the applied force which is in the direction of the object's displacement.
The force exerted on spring on stretching is known as restoring force. Restoring force acts in opposite direction to that of external deforming force and is equal in magnitude.
So, in stretching a string, external work is done.