File size: 580 Bytes
7a8878c
1
You are given two strings a and b, both consisting of lowercase Latin letters. A subsequence of a string is a string which can be obtained by removing several (possibly zero) characters from the original string. A substring of a string is a contiguous subsequence of that string.For example, consider the string abac:  a, b, c, ab, aa, ac, ba, bc, aba, abc, aac, bac and abac are its subsequences;  a, b, c, ab, ba, ac, aba, bac and abac are its substrings. Your task is to calculate the minimum possible length of the string that contains a as a substring and b as a subsequence.