I don't like change! Input:

Two strings without newlines or whitespaces.

Output:

Both input strings on separate lines, with spaces where necessary† for one of the two strings. And a third line with the characters A, R, M and , representing added, removed, modified, and unchanged.

† We add spaces to either the top or bottom input string (if we have to). The goal of this challenge is to output with the least amount of changes (ARM) possible, also known as the Levenshtein distance.

Example:

Let's say the input strings are ABCDEF and AFBECD, then the output would be this:

A B CDEF
AFBECD  
 A A  RR


Here are some other possible invalid outputs as example (and there are a lot more):

ABCDEF
AFBECD
 MMMMM

A BCDEF
AFBECD 
 A MMMR

AB CDEF
AFBECD 
 MAMMMR

ABC DEF
AFBECD 
 MMAMMR

ABC  DEF
AFBECD  
 MMAA RR

ABCDEF 
AFB ECD
 MMR MA

 AB CDEF   // This doesn't make much sense,
AFBECD     // but it's to show leading spaces are also allowed
AM A  RR


None of these have only four changes however, so only A B CDEF\nAFBECD  \n A A  RR is a valid output for this challenge.

Challenge rules:


You can assume the input strings won't contain any new-lines or spaces.  
The two input strings can be of different lengths.  
One of the two input strings should remain as is, except for optional leading/trailing spaces.
If your languages doesn't support anything besides ASCII, you can assume the input will only contain printable ASCII characters.  
The input and output format are flexible. You can have three separate Strings, a String array, a single String with new-lines, 2D character array, etc.  
You are allowed to use something else instead of ARM, but state what you've used (i.e. 123, or abc., etc.)
If more than one valid output is possible with the same amount of changes (ARM), you can choose whether to output one of the possible outputs or all of them.
Leading and trailing spaces are optional:

A B CDEF
AFBECD
 A A  RR


or

"A B CDEF\nAFBECD\n A A  RR"
                 ^
                 Note there are no spaces here



General rules:


This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.
Default Loopholes are forbidden.
If possible, please add a link with a test for your code.
Also, please add an explanation if necessary.


Test cases:

In: "ABCDEF" &amp; "AFBECD"

Output (4 changes):
A B CDEF
AFBECD  
 A A  RR                  

In: "This_is_an_example_text" &amp; "This_is_a_test_as_example"

Possible output (13 changes):
This_is_an       _example_text
This_is_a_test_as_example     
         MAAAAAAA        RRRRR

In: "AaAaABBbBBcCcCc" &amp; "abcABCabcABC"

Possible output (10 changes):
AaAaABBbBBcCcCc
 abcABCab cABC 
R MM  MMMR MM R

In: "intf(){longr=java.util.concurrent.ThreadLocalRandom.current().nextLong(10000000000L);returnr&gt;0?r%2:2;}" &amp; "intf(){intr=(int)(Math.random()*10);returnr&gt;0?r%2:2;}"

Possible output (60 changes):
intf(){longr=java.util.concurrent.ThreadLocalRandom.current().nextLong(10000000000L);returnr&gt;0?r%2:2;}
intf(){i ntr=(      i    n      t)(M  ath.r   andom        ()*         10          );returnr&gt;0?r%2:2;}
       MR M  MRRRRRR RRRR RRRRRR MMMRR MMMMRRR     RRRRRRRR  MRRRRRRRRR  RRRRRRRRRR 

In: "ABCDEF" &amp; "XABCDF"

Output (2 changes):
 ABCDEF
XABCD F 
A    R 

In: "abC" &amp; "ABC"

Output (2 changes):
abC
ABC
MM
JavaScript (ES6), 413 ... 343 342 bytes

Saved 5 bytes by tweaking the loop indices, as suggested by @KevinCruijssen

Takes input as 2 strings in currying syntax. Returns an array of 3 strings.

b=&gt;a=&gt;{m=[];x=a.length;y=b.length;for(i=j=0,c=d='';i&lt;=y;c+=R='R')m[i]=[[c,i++]];for(;j++&lt;x;)m[i=0][j]=[d+=A='A',j];for(;i&lt;y;i++)for(j=0;j&lt;x;)[C]=m[[X,S]=m[i][j],[Y,I]=m[i+1][j],[Z,D]=m[i][++j],Q=[Z+R,D+1],i+1][j]=b[i]==a[j-1]?[X+' ',S]:S&lt;I?D&lt;S?Q:[X+'M',S+1]:D&lt;I?Q:[Y+A,I+1];return[(g=s=&gt;C.replace(/./g,c=&gt;c==s?' ':b[i++],i=0))(A),g(R,b=a),C]}


Test cases



let f =

b=&gt;a=&gt;{m=[];x=a.length;y=b.length;for(i=j=0,c=d='';i&lt;=y;c+=R='R')m[i]=[[c,i++]];for(;j++&lt;x;)m[i=0][j]=[d+=A='A',j];for(;i&lt;y;i++)for(j=0;j&lt;x;)[C]=m[[X,S]=m[i][j],[Y,I]=m[i+1][j],[Z,D]=m[i][++j],Q=[Z+R,D+1],i+1][j]=b[i]==a[j-1]?[X+' ',S]:S&lt;I?D&lt;S?Q:[X+'M',S+1]:D&lt;I?Q:[Y+A,I+1];return[(g=s=&gt;C.replace(/./g,c=&gt;c==s?' ':b[i++],i=0))(A),g(R,b=a),C]}

console.log(f('ABCDEF')('AFBECD').join`\n`);
console.log(f('This_is_an       _example_text')('This_is_a_test_as_example').join`\n`);
console.log(f('AaAaABBbBBcCcCc')('abcABCabcABC').join`\n`);
console.log(f("intf(){longr=java.util.concurrent.ThreadLocalRandom.current().nextLong(10000000000L);returnr&gt;0?r%2:2;}")("intf(){intr=(int)(Math.random()*10);returnr&gt;0?r%2:2;}").join`\n`);
console.log(f('ABCDEF')('XABCDF').join`\n`);




Less golfed

b =&gt; a =&gt; {
  m = []; x = a.length; y = b.length;

  // initialize the leftmost column and the topmost row
  for(i = j = 0, c = d = ''; i &lt;= y; c += R = 'R')
    m[i] = [[c, i++]];
  for(; j++ &lt; x;)
    m[i = 0][j] = [d += A = 'A', j];

  // walk through the Levenshtein matrix
  for(; i &lt; y; i++)
    for(j = 0; j &lt; x;)
      [C] = m[                                // C = current string, once updated
        [X, S] = m[i][j],                     // substitution
        [Y, I] = m[i + 1][j],                 // insertion
        [Z, D] = m[i][++j],                   // deletion
        Q = [Z + R, D + 1],                   // precomputed update for deletion
        i + 1
      ][j] =
        b[i] == a[j - 1] ?
          [X + ' ', S]                        // unchanged character
        :
          S &lt; I ?
            D &lt; S ? Q : [X + 'M', S + 1]      // deletion or substitution
          :
            D &lt; I ? Q : [Y + A, I + 1];       // deletion or insertion

  return [
    // g = helper function to format the output strings by inserting spaces
    (g = s =&gt; C.replace(/./g, c =&gt; c == s ? ' ' : b[i++], i = 0))(A),
    g(R, b = a),

    // final modification string, picked from the last visited cell
    C
  ]
}


Example

Below is the initial matrix for b = "foo" and a = "ok":

//                     'o'           'k'
[ [ [ '',    0 ], [ 'A',   1 ], [ 'AA',  2 ] ],
  [ [ 'R',   1 ],  (undefined),  (undefined) ],  // 'f'
  [ [ 'RR',  2 ],  (undefined),  (undefined) ],  // 'o'
  [ [ 'RRR', 3 ],  (undefined),  (undefined) ] ] // 'o'


and here is the final matrix after all iterations:

//                     'o'           'k'
[ [ [ '',    0 ], [ 'A',   1 ], [ 'AA',  2 ] ],
  [ [ 'R',   1 ], [ 'M',   1 ], [ 'MA',  2 ] ],  // 'f'
  [ [ 'RR',  2 ], [ 'R ',  1 ], [ 'R A', 2 ] ],  // 'o'
  [ [ 'RRR', 3 ], [ 'RR ', 2 ], [ 'R M', 2 ] ] ] // 'o'


The final modification string along with the Levenshtein distance are stored in the bottom-right cell.