It looks like you could add counters for each of the operations:
if (Answer[i - 1] == Guess[j - 1]) d[i, j] = d[i - 1, j - 1]; //no operation else { int del = d[i-1, j] + 1; int ins = d[i, j-1] + 1; int sub = d[i-1, j-1] + 1; int op = Math.Min(Math.Min(del, ins), sub); d[i, j] = op; if (i == j) { if (op == del) ++deletions; else if (op == ins) ++insertions; else ++substitutions; } }
source share