TopcoderArchiveVisit Topcoder
SRM1 Apr 2002
SRM 76

DeAnagram

Problem statement, definition, constraints, and public examples.

Problem Statement

PROBLEM STATEMENT:
You are given a list of lowercase words.  Write down each letter as many times
as it appears in the word that has the most occurrences of that letter and then
arrange the letters in alphabetical order.  
For example if the list contains the words: paper, ape, pear  you should return
aeppr because within the words: 'a' appears at most once, 'e' appears at most
once, 'p' appears at most twice, and 'r' appears at most once.


DEFINITION:
 Class Name:  DeAnagram
Method Name:  prearrange
 Parameters:  String[]
    Returns:  String
method signature (make sure your method is public) String prearrange(String[]
words)

TopCoder will ensure the validity of these inputs
- words is a String[] with 1 to 50 elements inclusive.
- each element in the String[] contains lower case characters 'a'-'z' only.
- each element in the String[] is between 1 and 50 characters inclusive in
length.

EXAMPLES:
words={"lever"}					return "eelrv"		  
words={"whale", "awash", "bale"} 		return "aabehlsw"	  
words={"money", "mono", "men", "coy"}		return "cemnooy"	  
words={"sellers", "less"}			return "eellrss"  
words={"eccentric", "mop", "use"}		return "ccceeimnoprstu"

Definition

Class:
DeAnagram
Method:
prearrange
Parameters:
String[]
Returns:
String
Method signature:
String prearrange(String[] param0)
(be sure your method is public)

Constraints

    Examples

      No public sample cases were explicitly marked for this problem in the original data.

      Back to all problems