A base assembly string a is fixed. You want string b to appear as a subsequence of a after you append some characters to the END of a (you may append any characters you like). Find the minimum number of characters that must be appended.
Equivalently, match the longest prefix of b that already appears as a subsequence of a; every remaining character of b must be appended.
Input format
Line 1: the base string a.
Line 2: the required string b.
Output format
A single integer: the minimum number of characters to append.
Constraints
- 1 <= length of
a<= 40 - 1 <= length of
b<= 40 - Both strings consist of lowercase English letters only.