Simple implementation of dynamic time warping.