Huawei OD machine test - word reversal (JAVA, C, C++, GO, Python, JavaScript)

Huawei OD machine test question word reversal, JAVA & Python & C & C++ & GO & JavaScript

topic

Input an English article fragment,
reverse the order of words in the specified area,
punctuation marks are treated the same as ordinary letters,
for example, input a string
I am a developer.
[0,3]
and output
developer. a am I

enter

Use a newline to separate 3the parameters.
The first parameter is the content of the article, that is, the English string.
The second parameter is the reverse start word subscript, and the subscript starts from 0the beginning
. The third parameter is the end word subscript.

output

After flipping, each word of the English article fragment is separated and output by a half-width space

example one

enter

I am a developer.
0
3

output

developer. a am I

Example two

enter

hello world!
0
3

</

おすすめ

転載: blog.csdn.net/jiong9412/article/details/130375877