Edit distance DP with print path