#288. 字符串最后两字符交换

    ID: 288 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatString-1gesp3字符串

字符串最后两字符交换

Swap Last Two Characters

Background

None

Problem Description

Given a string of any length, return a new string where the last 2 characters, if present, are swapped. For example, "coding" yields "codign".

Input Format

Input is given from standard input in the following format.

A string.

Output Format

Output is printed to standard output in the following format.

The new string with the last two characters swapped.

Sample

coding
"codign"
cat
"cta"
ab
"ba"

Sample Explanation

For the input "coding\