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.
s = input()
t = input()
n = len(s)
m = len(t)
 
 
dp = [[0] * (n + 1) for _ in range(m + 1)]
 
for i in range(n):
    dp[m][i] = n - i
 
for j in range(m):
    dp[j][n] = m - j
 
for i in range(m - 1, -1, -1):
    for j in range(n - 1, -1, -1):
        if s[j] == t[i]:
            dp[i][j] = dp[i + 1][j + 1]
        else:
            insert = dp[i][j + 1]
            replace = dp[i + 1][j + 1]
            delete = dp[i + 1][j]
            dp[i][j] = 1 + min(insert, replace, delete)
 
print(dp[0][0])
# for i in range(len(dp)):
#     for j in range(len(dp[0])):
#         print(dp[i][j], end = " ")
#     print()
 
i = 0
j = 0
res = {}
while i < m and j < n:
    if t[i] == s[j]:
        i += 1
        j += 1
    else:    
        insert = dp[i + 1][j] if i <= m else float('inf')
        replace = dp[i + 1][j + 1] if i <= m and j <= n else float('inf')
        delete = dp[i][j + 1] if j <= n else float('inf')
 
        if insert <= replace and insert <= delete:
            print('INSERT', i + 1, t[i])
            i += 1
        
        elif replace <= insert and replace <= delete:
            print('REPLACE', i + 1, t[i])
            i += 1
            j += 1
 
        else:
            print('DELETE', i + 1, t[i])
            j += 1
 
for op, v in res.items():
    for char, freq in v.items():
        print(op, freq, char)