Associated Course(s):
Interview Preparation

Given two strings str1 and str2 and below operations that can performed on str1. Find minimum number of edits (operations) required to convert ‘str1′ into ‘str2′.

- Insert
- Remove
- Replace

All of the above operations are of cost=1.

Both the strings are of lowercase.

**Input:**

The First line of the input contains an integer T denoting the number of test cases. Then T test cases follow. Each tese case consists of two lines. The first line of each test case consists of two space separated integers P and Q denoting the length of the strings str1 and str2 respectively. The second line of each test case coantains two space separated strings str1 and str2 in order.

**Output:**

Corresponding to each test case, pirnt in a new line, the minimum number of operations required.

**Constraints:**

1<=T<=50

1<= Length(str1) <= 100

1<= Length(str2) <= 100

**Example:**

**Input:**

1

4 5

geek gesek

**Output:**

1

may55 | 86 |

ashujack | 84 |

aman19 | 82 |

abbatta7 | 75 |

lakshmi_pandey | 74 |

saumitra13325 | 648 |

ashujack | 591 |

aman19 | 562 |

lakshmi_pandey | 546 |

aroma17 | 535 |

blackshadows | 5249 |

akhayrutdinov | 5111 |

Ibrahim Nash | 5087 |

Quandray | 4354 |

sanjay05 | 3668 |

Login to report an issue on this page.