Competitions

# Concatenation

Famous programmer Gennady likes to create new words. One way to do it is to concatenate existing words. That means writing one word after another. For example, if he has words "cat" and "dog", he would get a word "catdog", that could mean something like the name of a creature with two heads: one cat head and one dog head.

Gennady is a bit bored of this way of creating new words, so he has invented another method. He takes a non-empty prefix of the first word, a non-empty suffix of the second word, and concatenates them. For example, if he has words "tree" and "heap", he can get such words as "treap", "tap", or "theap". Who knows what they could mean?

Gennady chooses two words and wants to know how many different words he can create using his new method. Of course, being a famous programmer, he has already calculated the answer. Can you do the same?

#### Input

Two lines contain words chosen by Gennady. They have lengths between 1 and 100 000 characters and consist of lowercase English letters only.

#### Output

Output one integer - the number of different words Gennady can create out of given words.

Time limit 1 second
Memory limit 128 MiB
Input example #1
cat
dog

Output example #1
9

Input example #2
tree
heap

Output example #2
14

Source 2015 ACM NEERC, Northern Subregion, October 24, Problem C