题目描述
Problem Background
Contest Reminder: No explanations will be provided for Sample 4 or cases with no solution.
Contest Reminder: No explanations will be provided for the output format or the Special Judge.
Contest Reminder: Sorry, the Special Judge for this problem does not ignore trailing spaces at the end of lines. Ensure there are no extra characters in the two lines.
Contest Reminder: Apologies, the input data for this problem is in Windows format, not Linux format, so there is an extra $\r$ character before the $\n$ at the end. Please use scanf or cin to read the data instead of getline, as the latter will read an extra $\r$.
Problem Description
Xiao X participates in a singing contest.
After a tough battle, Xiao X finally makes it to the finals, where his opponent is Xiao Y.
The champion of this singing contest is determined by the number of likes. Whoever has more likes wins the championship.
After Xiao X and Xiao Y finish singing their final songs, their final number of likes is determined.
To increase suspense, the host decides to compare the likes of Xiao X and Xiao Y starting from the last digit and moving forward.
For example, if Xiao X has 37 likes and Xiao Y has 28 likes. First, compare the last digit, Xiao X has 7 and Xiao Y has 8, so Xiao Y is temporarily leading. Then compare the previous digit, Xiao X has 37 and Xiao Y has 28, so Xiao X is temporarily leading. If we use X to represent Xiao X temporarily leading and Y to represent Xiao Y temporarily leading, we can write a string XY.
Another example, if Xiao X has 137 likes and Xiao Y has 47 likes. If we use Z to represent the situation where Xiao X and Xiao Y have the same number of likes temporarily, the string should be XYZ.
As a master of OI, you know that this comparison method is very unscientific, it's just dragging out time. However, you are interested in the final string written down.
Now, you have obtained this final string, and you need to construct a possible number of likes for Xiao X and Xiao Y.
If there is no possible number of likes that satisfies the string, you only need to output -1.
For convenience, use leading zeros to pad the numbers.
Input and Output Format
Input Format
A single line containing a string $s$, representing the final string written down.
Output Format
If there is a solution:
- The first line is an integer representing the number of likes for Xiao X.
- The second line is an integer representing the number of likes for Xiao Y.
If there is no solution:
- A single line containing the integer
-1.
Sample Input and Output
Sample Input #1
XY
Sample Output #1
37
28
Sample Input #2
XYZ
Sample Output #2
137
047
Sample Input #3
ZZZZZZ
Sample Output #3
000000
000000
Sample Input #4
XYZXYZ
Sample Output #4
-1
Notes
This problem uses bundled testing.
- Subtask 1 (11 points): $\text{len}(s) = 1$.
- Subtask 2 (42 points): $s_i \in \{\texttt{X},\texttt{Y}\}$.
- Subtask 3 (21 points): The data guarantees a solution.
- Subtask 4 (26 points): No special restrictions.
For $100\%$ of the data, $s_i \in \{\texttt{X},\texttt{Y},\texttt{Z}\}$, $1 \le \text{len}(s) \le 10^6$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分