You are given two strings A and B.
A string X is a subsequence of a string S if you can delete zero or more characters from S and join the remaining characters, in their original order, to get X.
Write a program that computes the length of the shortest string S that has both A and B as subsequences.
For example, if A = "abcbdab" and B = "bdcaba", then S = "abdcabdab" has both of them as subsequences, and no S shorter than 9 works.
The first line contains the string A and the second line contains the string B. Both strings consist of lowercase letters only, and each has length between 1 and 1,000.
Print the length of the shortest string that has both A and B as subsequences.