There is a string *s*, consisting of capital Latin letters. Let's denote its current length as |*s*|. During one move it is allowed to apply one of the following operations to it: 
 -  INSERT *pos* *ch* — insert a letter *ch* in the string *s* in the position *pos* (1 ≤ *pos* ≤ |*s*| + 1, *A* ≤ *ch* ≤ *Z*). The letter *ch* becomes the *pos*-th symbol of the string *s*, at that the letters shift aside and the length of the string increases by 1. -  DELETE *pos* — delete a character number *pos* (1 ≤ *pos* ≤ |*s*|) from the string *s*. At that the letters shift together and the length of the string decreases by 1. -  REPLACE *pos* *ch* — the letter in the position *pos* of the line *s* is replaced by *ch* (1 ≤ *pos* ≤ |*s*|, *A* ≤ *ch* ≤ *Z*). At that the length of the string does not change. 
Your task is to find in which minimal number of moves one can get a *t* string from an *s* string. You should also find the sequence of actions leading to the required results.
The first line contains *s*, the second line contains *t*. The lines consist only of capital Latin letters, their lengths are positive numbers from 1 to 1000.
# Changing A String

def findOperation(left, above):
    if left == above:
        return 'R'
    elif left < above:
        return 'I'
    elif left > above:
        return 'D'


s = input()
t = input()

dp = [[0 for x in range(len(t)+1)] for y in range(len(s)+1)]

for i in range(len(s)+1):
    for j in range(len(t)+1):
        if i == 0:
            dp[i][j] = j
        elif j == 0:
            dp[i][j] = i
        elif s[i-1] == t[j-1]:
            dp[i][j] = dp[i-1][j-1]
        else:
            dp[i][j] = 1 + min(dp[i][j-1], dp[i-1][j], dp[i-1][j-1])

#for d in dp:
#    print(d)

print(dp[len(s)][len(t)])

i = len(s)
j = len(t)
operations = []
while(i > 0 and j > 0):


    if(dp[i][j] == dp[i-1][j-1] and not (abs(dp[i-1][j] - dp[i][j-1]) >= 2)):
        i -= 1
        j -= 1
        continue

    op = findOperation(dp[i][j-1], dp[i-1][j])
    if op == 'I':
        j -= 1
        operations.append((op, j+1, t[j]))
    elif op == 'D':
        i -= 1
        operations.append((op, j+1))
    elif op == 'R':
        i -= 1
        j -= 1
        operations.append((op, j+1, t[j]))
    else:
        print('uh oh something went wrong')

for op in reversed(operations):
    if op[0] == 'I':
        print(f"INSERT {op[1]} {op[2]}")
    elif op[0] == 'D':
        print(f"DELETE {op[1]}")
    else:
        print(f"REPLACE {op[1]} {op[2]}")


 	 	 		 	 	  	 			   	  	   	