Edit Distance Yet Again

아직 제출이 없습니다시간 제한20초메모리 제한512 MB

문제

Have you ever heard of the edit distance problem? Given two strings of lowercase English letters, you must determine the minimum number of operations needed to transform the first one into the second one. A single operation can be either:

  • inserting a character into the sequence, at any spot,
  • deleting any character from the sequence,
  • substituting a character with another one.

Everyone at our university loves this problem a lot -- maybe a little bit too much -- so we decided to create a problem which is easier!  You are given two strings s=s_1s_ns = s\_1 \ldots s\_n, t=t_1t_mt = t\_1 \ldots t\_m and an integer kk. Find out whether the edit distance between the strings is less than or equal to kk. If so, you are also asked to provide any sequence of minimum possible number of operations to transform the first string into the second one.

입력

The first line of input contains the number of test cases zz (1z1001 \leq z \leq 100). The descriptions of the test cases follow.

The first line of each test case contains three integers n,m,kn, m, k (1n,m1,000,0001 \leq n, m \leq 1\\,000\\,000, 0k10000 \leq k \leq 1000) -- the lengths of the strings and the parameter from the problem description.

The second line contains a string of length nn consisting of lowercase English letters -- the string ss from the problem description.

The third line contains a string of length mm consisting of lowercase English letters -- the string tt from the problem description.

The total length of all strings in all test cases will not exceed 10710^7.

출력

For each test case, if the edit distance is greater than kk, output a single line containing the word "NO".  Otherwise, the first line should contain the word "YES", and the next lines should describe the answer as follows:

In the second line output the minimum number rr of operations required to transform ss into tt. In the next rr lines output the operations, one per line.

  • To insert a lowercase English character cc into a sequence of size ww at the position pp (1pw+11 \leq p \leq w + 1), print INSERT p c.
  • To delete a character from a sequence of size ww from the position pp (1pw1 \leq p \leq w), print DELETE p.
  • To substitute a character in a sequence of size ww from the position pp (1pw1 \leq p \leq w) with a lowercase English character cc, print REPLACE p c.