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

PROGRAMMING:Word flipping

Luz5年前 (2021-05-10)题库389
Enter a string containing many words from the keyboard. Each word is separated by one or more spaces. It is required to flip each word, but the order of the words in the sentence does not change. Note that there may be multiple spaces before and after the line.
###Input format:
A string containing many words. Each word is separated by one or more spaces. It is required to flip each word, but the order of the words in the sentence does not change. Note that there may be multiple spaces before and after the line. The total length of the string does not exceed 1000, the number of words does not exceed 50, and each word does not exceed 20 letters. Test data to ensure that the input characters only contain English letters and spaces.
###Output format:
Output the flipped string. Output a space after each word. Note that there should be no extra space before the line. There can only be 1 space at the end of a line.
###Input sample 1:
```in
olleH dlroW
```
###Output sample 1:
```out
Hello World
```
###Input sample 2:
```in
I ma a tneduts
```
###Output sample 2:
```out
I am a student
```






answer:If there is no answer, please comment