Given two strings, we want to write them in lexicographic order.
Note: Recall that the comparison
operator
in C++ is defined for strings as the lexicographic order, that is, the
expression
evaluates to true if
is lexicographically smaller than
.
Note: It is not allowed to use functions, vectors and any other way to store massive data (although you can read the input as strings, but not to access to their positions). The solution must deal with the input data sequentially without storing arbitrarily large intermediate memory.
The input has several cases, each one described in one line. For each case, we have two strings and .
For each case, you have to write the smallest of and , followed by a blank space, followed by the biggest of and , in one line.
Input
hello bye bye hello a a aaa aba aba aaa aaa aab aab aaa abb ba ba abb
Output
bye hello bye hello a a aaa aba aaa aba aaa aab aaa aab abb ba abb ba