#C9846. Reorder String: All a's Before b's

    ID: 53984 Type: Default 1000ms 256MiB

Reorder String: All a's Before b's

Reorder String: All a's Before b's

Problem Description:

Given a string S consisting only of the characters (a) and (b), your task is to reorder the string such that all occurrences of (a) appear before any occurrence of (b).

For example, the string "abba" should become "aabb" and "bab" should become "ab". If the string is empty, simply output an empty string.

The solution should run in (O(n)) time, where (n) is the length of the string, and use minimal extra memory.

inputFormat

Input:
The input consists of a single line containing the string S made up exclusively of the characters (a) and (b). This string is read from the standard input.

outputFormat

Output:
Print the reordered string where all (a)'s come before all (b)'s. The result is output to the standard output.## sample

abba
aabb