问题3243--EditingOperation

3243: EditingOperation

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 64 MB

题目描述

There are two strings: A and B. We define an editing operation as “Insert a character”, “Delete a character” or “Replace a character”. So your task is to calculate how many editing operations do we need to make B become the substring of A? If the answer is more than the given limitation, just output -1.

输入

Multiple test cases. There are 3 lines in each test case: String A is given in the first line, and the length of A is from 0 to 1000000. String B is given in the second line, and the length of B is from 0 to 1000. In the third line, there is an integer LIM. (0<= LIM <=30)

输出

Print the number of editing operations in one line. If the answer is more than LIM, just output -1.

样例输入 Copy

annealing
annual
3

样例输出 Copy

1