TopcoderArchiveVisit Topcoder
SRM15 May 2001
SRM 2

LetterSort

Problem statement, definition, constraints, and public examples.

Problem Statement

Implement a class LetterSort, which contains a method doSort.  doSort takes a
String as a parameter and sorts the characters in the string in order of their
first appearance in the string.  For example CABCACCB sorts to CCCCAABB.  The
method doSort should return the sorted String.

The method signature is:
public String doSort(String input);

input is a string of at least 1 character and at most 50 characters.  The
characters are letters or numbers.

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

Examples:
If input="TopCoder", the method returns "ToopCder"
If input="HiHowAreYou", the method returns "HHioowAreYu"

Definition

Class:
LetterSort
Method:
doSort
Parameters:
String
Returns:
String
Method signature:
String doSort(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