Compute edit distance kitten->sitting, show alignment

The input is two strings joined by one pipe, source|target. Return one canonical witness string with four pipe-separated fields: distance|alignedSource|alignedTarget|operations. The aligned strings have equal length, use - for a gap, and operations uses M for a match, S for a substitution, D for deleting a source character, and I for inserting a target character. For deterministic output, traceback prefers a match, then substitution, then deletion, then insertion whenever choices have the same optimal cost. The canonical example is kitten|sitting, whose distance is 3.

Examples
Input: "kitten|sitting"
Output: "3|kitten-|sitting|SMMMSMI"
Hints

Compute edit distance kitten->sitting, show alignment

The input is two strings joined by one pipe, `source|target`. Return one canonical witness string with four pipe-separated fields: `distance|alignedSource|alignedTarget|operations`. The aligned strings have equal length, use `-` for a gap, and `operations` uses `M` for a match, `S` for a substitution, `D` for deleting a source character, and `I` for inserting a target character. For deterministic output, traceback prefers a match, then substitution, then deletion, then insertion whenever choices have the same optimal cost. The canonical example is `kitten|sitting`, whose distance is 3.