Gennady, a well known programmer, likes to make new words. One way to do it is to concatenate two existing words, that is, to write one word right after another. If he has "cat" and "dog", he gets "catdog", which could name a creature with one cat head and one dog head.
Gennady is bored of that method, so he invented another one. He takes a non-empty prefix of the first word and a non-empty suffix of the second word, then concatenates them. If he has "tree" and "heap", he can get words such as "treap", "tap", or "theap".
Gennady picked two words. Count how many different words he can make with the new method.