AC Edit Distance