  Symbol-pair codes are block codes with symbol-pair metrics designed to
protect against pair-errors that may occur in high-density data storage
systems. MDS symbol-pair codes are optimal in the sense that it can attain the
highest pair-error correctability within the same code length and code size.
Constructing MDS symbol-pair codes is one of the main topics in symbol-pair
codes. In this paper, we characterize the symbol-pair distances of some
constacyclic codes of arbitrary lengths over finite fields and a class of
finite chain rings. Using the characterization of symbol-pair distance, we
present several classes of MDS symbol-pair constacyclic codes and show that
there is no other MDS symbol-pair code among the class of constacyclic codes
except for what we present. Moreover, some of these MDS symbol-pair
constacyclic codes over the finite chain rings cannot be obtained by previous
work.
