Massless string vs massless spring in a mass-spring system 

Two masses connected by a massless spring, on a frictionless surface , and a force of $60$N is applied to the 15kg mass such that it accelerates at 2 $\frac{m}{s^2}$. What is the acceleration of the $10kg$ mass? 

I came across this question. I first thought that that the $10$kg was constrained to move at the same acceleration. But when I work it out, I get $a_2$ = 3 $\frac{m}{s^2}$. And it is the correct answer according to the book. 
What I am unable to understand is, isn’t the $10$kg mass constrained to move at the same acceleration as the $15$kg mass? I thought we could replace  the massless spring by (or treat it as) a massless string and results would be the same. Am I making a fundamental mistake?
 A: The problem is poorly stated.  If a 60 Nt force is applied to a 15 kg mass, the acceleration will be 4 m/s/s.  The 10 kg mass will start slowly and accelerate as the spring is stretched. The two masses will then oscillate relative to each other.  At some later instant when the force from the spring is 30 Nt, the 15 kg will be accelerating at 2 m/s/s and the 10 kg at 3 m/s/s.
A: The thing is, an 'inelastic' massless string ensures constrained motion because it has a definite length. 
If x is the distance moved by the first block, then the second block is also constrained to move so that the net extension of the string is 0.
But, a spring can become compressed or stretched. So, if block 1 covers a distance x, three cases arise:
i) spring becomes compressed: the second block moves a distance more than x, and hence has greater acceleration 

ii) spring becomes stretched: the second block moves a distance less than x, and hence has less acceleration

iii) spring remains in original shape: the blocks have equal acceleration  
A: a string is rigid so cannot be extended or compressed, its both end would move with same acceleration
in spring, it can extend, if spring extends then it would apply equal forces on both
bodies i.e $kx$ ,towards left for $15 kg$ and towards right for $10 kg$.
the only force moving  $10 kg$ is    $kx$
now if you apply this concept to string you will get different acceleration on both sides which is not possible, so acceleration in case of strings is constrained
