TopcoderArchiveVisit Topcoder
SRM21 Mar 2002
SRM 73

StringSort

Problem statement, definition, constraints, and public examples.

Problem Statement

PROBLEM STATEMENT

You are given a String consisting of lower-case letters.  Sort the characters
within that String in ascending alphabetical order, and return the resulting
String.  For example, if you are given the String "dbcba", you would re-arrange
the letters to form the String "abbcd".

DEFINITION

Class: StringSort
Parameters: String
Returns: String
Method signature (be sure your method is public): String sort(String str);

INPUT CONSTRAINTS

TopCoder will verify that all input constraints are met.
- str will contain between 0 and 50 characters, inclusive.
- str will contain only lower-case letters (a-z).

EXAMPLES:

str: "pickle"
Returns: "ceiklp"

str: "abhor"
Returns: "abhor"

str: "sortthisstring"
Returns: "ghiinorrsssttt"

str: "tesla"
Returns: "aelst"

str: ""
Returns: ""

Definition

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