#B4301. Swap the First and Last Digit

    ID: 11957 Type: Default 1000ms 256MiB

Swap the First and Last Digit

Swap the First and Last Digit

Given a positive integer \(n\), swap its first and last digits and output the resulting number. If the result contains leading zeros, remove them before outputting.

Note: A leading zero, such as the \(0\) in \(0201\), does not affect the numerical value, so after removing the leading zeros \(0201\) becomes \(201\).

Examples:

  • For \(n = 173\): swapping the first digit \(1\) with the last digit \(3\) yields \(371\).
  • For \(n = 10200\): swapping gives \(00201\), which becomes \(201\) after removing the leading zeros.

inputFormat

The input consists of a single positive integer \(n\) given in one line.

outputFormat

Output the number after swapping the first and last digits. If the result has leading zeros, remove them before printing.

sample

173
371