Order two strings

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 s < t
evaluates to true if s is lexicographically smaller than t.

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.

Input

The input has several cases, each one described in one line. For each
case, we have two strings s and t.

Output

For each case, you have to write the smallest of s and t, followed by a
blank space, followed by the biggest of s and t, in one line.

Observation

Problem information

Author: Guillem Godoy

Generation: 2026-01-25T14:26:50.475Z

© Jutge.org, 2006–2026.
https://jutge.org
