#K15296. Temperature Conversion
Temperature Conversion
Temperature Conversion
You are given a string representing a temperature value followed by its unit. The unit can either be C (Celsius) or F (Fahrenheit). Your task is to convert the temperature from Celsius to Fahrenheit or vice versa.
The formulas used for conversion are given below in \( \LaTeX \) notation:
- \( F = \frac{9}{5} \times C + 32 \)
- \( C = \frac{5}{9} \times (F - 32) \)
If the input format is invalid, or if the temperature value cannot be parsed, print "Invalid input".
inputFormat
The input consists of a single line containing a temperature string. The string includes a numerical value followed immediately by a unit character. The unit is either C
or F
.
outputFormat
The output is a single line containing the converted temperature value with its unit. The numerical value should be formatted to one decimal place. If the input is invalid, output exactly "Invalid input".
## sample25C
77.0F