An optimal arc consistency algorithm for a particular case of sequence constraint