This is a straighforward modification of the classical dynamic programming algorithm.
Let the first string be $s = s_1 s_2 \dots s_n$ and the second string be $t = t_1 t_2 \dots t_m$.
In the dynamic programming algorithm you define $D[i][j]$ as the edit distance between $s_1 s_2 \dots s_i$ and $t_1 t_2 \dots t_j$.
As a consequence, the edit distance between $s$ and $t$ will be $D[n][m]$.
The bases cases are $D[0][j]=j$ and $D[i][0]=i$ (for any $i = 0, \dots, n$ and $j=0, \dots, m$), and the recursive formula (for $i>0$ and $j>0$) is:
$$
D[i][j] = \min \begin{cases}
1 + D[i-1][j] & \mbox{ deletion of $s_i$};\\
1 + D[i][j-1] & \mbox{ insertion of $t_j$};\\
1_{s_i \neq t_j} + D[i-1][j-1] & \mbox{ substitution of $s_i$ with $t_j$}.
\end{cases},
$$
where $1_{s_i \neq t_j}$ is $1$ if $s_i \neq t_j$ and $0$ otherwise.
You can simply modify the above formula by not contemplating the last case when $s_i \neq t_j$, i.e.:
$$D[i][j] = \min \begin{cases}
1 + D[i-1][j] \\
1 + D[i][j-1] \\
D[i-1][j-1] & \mbox{only if $s_i = t_j$}.
\end{cases}
$$