JOIN
Get Time

   Problem Statement  

 Problem Statement for TopFox

Problem Statement

    Fox Ciel is planning to register on TopFox. Her family name is familyName and her given name is givenName.



She will choose a TopFox handle according to the following rule. Let s be a non-empty prefix of her family name and let t be a non-empty prefix of her given name. Now Fox Ciel may choose the concatenation of s and t as her handle.



For example, suppose Fox Ciel's family name is "fox" and her given name is "ciel". She may choose the handle "foxciel", "fc", or "foxc". She may not choose "ox", "ciel", or "jiro".



You are told Fox Ciel's family name and given name. Return the number of possible handles Fox Ciel may choose.
 

Definition

    
Class:TopFox
Method:possibleHandles
Parameters:String, String
Returns:int
Method signature:int possibleHandles(String familyName, String givenName)
(be sure your method is public)
    
 

Constraints

-familyName will contain between 2 and 10 characters, inclusive.
-Each character in familyName will be a lowercase English letter, i.e., 'a'-'z'.
-givenName will contain between 2 and 10 characters, inclusive.
-Each character in givenName will be a lowercase English letter, i.e., 'a'-'z'.
 

Examples

0)
    
"ab"
"cd"
Returns: 4
There are 4 possible handles: "a" + "c" = "ac", "a" + "cd" = "acd", "ab" + "c" = "abc" and "ab" + "cd" = "abcd".
1)
    
"abb"
"bbc"
Returns: 7
There are 7 possible handles: "ab", "abb", "abbc", "abbb", "abbbc", "abbbb", "abbbbc".
2)
    
"fox"
"ciel"
Returns: 12
3)
    
"abbbb"
"bbbbbbbc"
Returns: 16
4)
    
"abxy"
"xyxyxc"
Returns: 21
5)
    
"ababababab"
"bababababa"
Returns: 68

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.

This problem was used for:
       Single Round Match 584 Round 1 - Division II, Level One