Statistics

Problem Statement for "FreqCounter"

Problem Statement

Class name: FreqCounter
Method name: getFreq
Parameters: String
Returns: String

Implement a class FreqCounter containing a method getFreq.  The method inputs a
String, counts the number of times each letter occurs in a String and returns a
String containing one of each character in the input String, followed the
number of times the character occurs in the input String. The characters in the
return string should be in the order they first appear in the input string.

Here is the method signature (be sure your method is public):
String getFreq(String input);

input will be between 1 and 50 letters (a-z, A-Z) in length, inclusive.

"Helloworld" returns "H1e1l3o2w1r1d1" because there is one capital H, there is
one lowercase e, there are three lowercase l's, etc...

Examples:
"abracadabra" returns "a5b2r2c1d1"
"zookeeper" returns "z1o2k1e3p1r1"
"kalamazoo" returns "k1a3l1m1z1o2" (That is the letter l followed by the number
one)
"aAaAa" returns "a3A2"

Definition

Class:
FreqCounter
Method:
getFreq
Parameters:
String
Returns:
String
Method signature:
String getFreq(String param0)
(be sure your method is public)

Constraints

    Examples


      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)2024, TopCoder, Inc. All rights reserved.
      This problem was used for: