#K14586. Swap First and Last Characters
Swap First and Last Characters
Swap First and Last Characters
Given a string ( s ), your task is to swap its first and last characters. If the string contains only one character, the output remains unchanged.
For example, if ( s = "hello" ), then the output should be ( "oellh" ). Please note that the function should handle any valid string input including those containing spaces, digits, and special characters.
inputFormat
Input is provided via standard input (stdin) and consists of a single line representing the string ( s ).
outputFormat
The output, printed to standard output (stdout), is the resulting string after swapping the first and last characters of ( s ).## sample
a
a