题目描述
Problem Background
The following is the original problem statement for reference:
Given a number, reverse the digits of the number to obtain a new number.
This differs from the first question of the Junior Group in NOIp2011: the number can be a decimal, fraction, percentage, or integer. Integer reversal involves reversing all digits; decimal reversal involves reversing the integer part and then the decimal part without swapping them; fraction reversal involves reversing the denominator and then the numerator without swapping them; the numerator of a percentage is always an integer, and only the numeric part of the percentage changes. The new integer should also conform to the common form of integers, i.e., unless the original number is zero, the highest digit of the new number should not be zero; the end of the new decimal should not be $0$ (unless the decimal part consists only of $0$, then only one $0$ is retained); the fraction is not reduced, and neither the numerator nor the denominator is a decimal (sorry, students who reduce fractions, you cannot pass. The input data guarantees that the denominator is not $0$). There are no negative numbers in this problem.
Problem Description
Given a number, reverse the digits of the number to obtain a new number.
This differs from the first question of the Junior Group in NOIp2011: the number can be a decimal, fraction, percentage, or integer.
-
Integer reversal involves reversing all digits.
-
Decimal reversal involves reversing the integer part and then the decimal part without swapping them.
-
Fraction reversal involves reversing the denominator and then the numerator without swapping them.
-
The numerator of a percentage is always an integer, and only the numeric part of the percentage changes.
Input Format
A real number $s$
Output Format
A real number, which is the reversed number of $s$
Sample Input and Output
Input Sample #1
5087462
Output Sample #1
2647805
Input Sample #2
600.084
Output Sample #2
6.48
Input Sample #3
700/27
Output Sample #3
7/72
Input Sample #4
8670%
Output Sample #4
768%
Notes
[Data Range]
- For $25\%$ of the data, $s$ is an integer, no more than 20 digits;
- For $25\%$ of the data, $s$ is a decimal, with both the integer and decimal parts no more than 10 digits;
- For $25\%$ of the data, $s$ is a fraction, with both the numerator and denominator no more than 10 digits;
- For $25\%$ of the data, $s$ is a percentage, with the numerator no more than 19 digits.
[Data Guarantee]
-
For integer reversal, the original and new integers conform to the common form of integers, i.e., unless the original number is zero, the highest digit of the new number should not be zero.
-
For decimal reversal, the part before the decimal point is as above, and the part after the decimal point is guaranteed to conform to the common form of decimals, i.e., there are no trailing zeros (if the decimal part consists only of $0$, then only one $0$ is retained. If there are trailing zeros after reversal, omit the extra zeros).
-
For fraction reversal, the fraction is not reduced, and neither the numerator nor the denominator is a decimal. The input guarantees that the denominator is not $0$. See the relevant provisions for integer reversal above.
-
For percentage reversal, see the relevant content for integer reversal.
There are no negative numbers in the data.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分