TopCoder problem "CommonChar" used in SRM 3 (Division I Level One , Division II Level One)



Problem Statement

    
Class Name: CommonChar
Method Name: compare
parameters:  String, String
returns: int

Create a class CommonChar containing the method compare. This method will take
two Strings as inputs and return the number of characters in the second String
that are contained in the first string, in a one-to-one relationship.  That is,
if a character is repeated in the second string, it must be repeated in the
first string to count more than once.

Here is the method signature:
public int compare(String input1, String input2);

BOth Strings will have fewer than 100 characters.

Note:
-The method is case sensitive.  A is a different character than a.

Examples:
("java", "abava") -> 3  (two of the (a)s and the (v))
("TopCoder", "code guru") -> 4
("foobar", "sing") -> 0 
 

Definition

    
Class:CommonChar
Method:compare
Parameters:String, String
Returns:int
Method signature:int compare(String param0, String param1)
(be sure your method is public)
    

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=58

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=3002&pm=58

Writer:

Unknown

Testers:

Problem categories: