New Word
Time limit1sMemory limit1024 MB
Count the distinct words formed by joining a non-empty prefix of s with a non-empty suffix of t.
Statement
In computer science, people sometimes form a new word by taking the beginning of one word and the end of another. For example, the words "tree" and "heap" form the word "treap".
You are given a word and a word . How many different words can be formed by appending a non-empty suffix of to a non-empty prefix of ?
Input
The first line contains the word .
The second line contains the word .
Both words are non-empty and consist of lowercase Latin letters. The length of each word does not exceed .
Output
Print one integer, the number of different words that can be formed by appending a non-empty suffix of to a non-empty prefix of .