A subsequence of a string is obtained by removing zero or more characters from it. You are given three strings. You must determine the number of different non-empty subsequences they all share.
In sample , the subsequences common to all of the strings are: "c", "a", "l", "al", "ca", and "cl".
Each test case consists of three words, each on a separate line. The length of each word is no more than . Each word contains only lowercase Latin letters (a–z).
For each test case, print the number of different non-empty subsequences the three words all share on a separate line.
Example 1