#T567. 服务器的维护
服务器的维护
Description
As is well known, the price of a server is xxx, and to improve judging efficiency, CodesOnline purchased n servers at once, all installed with the Liuux system. However, the Liuux system on these servers is quite peculiar—it requires outputting a specific character to be usable.
The specific character is determined by two factors: the boot time and whether the boot was successful.
The boot time format is mm-dd-hh (where m, d, and h represent month, day, and hour, respectively, and mm represents a two-digit month).
Boot method: A for a successful boot, B for an unsuccessful boot.
The specified character format is: mm-dd-hh-A or mm-dd-hh-B.
Input Format
The input consists of two lines:
- The first line is the boot time, with three numbers
m,d,h, separated by spaces. - The second line is the boot method, either
AorB.
Output Format
-
The first line: Output the specific character.
- Requirements for the specific character:
mm-dd-hh-A/B, where the string must not contain0or-. - Finally, reverse the string and output it.
- Requirements for the specific character:
-
The second line: Output the length of the string.
Example
Input:
12 3 5
A
Output:
A53-21-21
9
Explanation:
- The formatted time is
12-03-05. - After removing
0and-, it becomes1235. - Appending the boot method
Agives1235A. - Reversing it yields
A5321. - The length is
5.
Note:
- Ensure that the month, day, and hour are always two digits (e.g.,
3becomes03). - Remove all
0s and-s before reversing. - The reversed string is the final output.
- The length is calculated based on the reversed string.
10 5 12
B
B2151
5
Source
Original question by CodesOnline