最短公共子序列
Problem statement:
问题陈述:
Given two strings, you have to find the shortest common super sequence between them and print the length of the super sequence.
给定两个字符串,您必须找到它们之间最短的公共超级序列,并打印超级序列的长度。
Input:
T Test case
T no of input string will be given to you.
E.g.
3
abcd abxy
sghk rfgh
svd vjhfd
Constrain
1≤ length (string1) ≤100
1≤ length (string2) ≤100
Output:
Print the length of the shortest super sequence formed from these two strings.
Example
例
T=3
Input:
abcd abxy
Output:
6 (abcdxy)
Input:
sghk rfgh
Output:
6 (srfghk)
Input:
svd vjhfd
Output:
6 (svjhfd)
Explanation with example:
举例说明:
Let there are two strings str1 and str2.
假设有两个字符串str1和str2 。
str1 = "abcd"
str2 = "abxy"
To find out the length of the super sequence from these two string is a bit difficult. To solve this problem we have to follow these steps:
从这两个字符串中找出超级序列的长度有些困难。 要解决此问题,我们必须遵循以下步骤:
We hav