-->
当前位置:首页 > 题库

PROGRAMMING:Flip word order

Luz5年前 (2021-05-10)题库400
Given a string, flip the string. When flipping, the order of characters in the word remains unchanged. For example, if the string is "Hello world", it is flipped to "World Hello". Words are separated by one or more spaces. Note that there may be multiple spaces at the beginning and end of the string. Remove extra white space when outputting. Only one space between each word. There are no spaces at the end of each line of the output.
###Input format:
The input may include multiple lines. Each line represents a string, with the exception of spaces, punctuation is treated like normal letters. You can think that the total number of characters in a line will not exceed 50000, the number of words will not exceed 600, and the length of each word will not exceed 30.
###Output format:
The output includes multiple lines, and each line corresponds to the input line, which is the flipped string. Remove extra white space when outputting. Only space each word before it. There are no spaces at the end of each line of the output.
###Input example:
Here is a set of inputs. For example:
```in
student. a am I
World Hello
```
###Output example:
The corresponding output is given here. For example:
```out
I am a student.
Hello World
```







answer:If there is no answer, please comment