World Languages, asked by nainasharma20899, 5 months ago

Mirror Sentence
You are given a string S containing a sentence.
Write a program to reverse the order of occurrence of words in the sentence.
Note: You need to ensure that all words are followed by a single
in your output
Function Description
Complete the Mirror Sentence function in the editor below. It has the following parameter(s):
Name
Type
Description
Parameters
STRING
Given String
h
The function must return an STRING denoting the new sentence in
reverse order of occurence of words.
Return
Constraints
• 1 < len(s) < 10^3​

Answers

Answered by goswamivv
0

Answer:

I dont know this one is so tricky please ask anotjer one

Answered by sreeag2004
2

Explanation:

Algorithm:

Initially, reverse the individual words of the given string one by one, for the above example, after reversing individual words the string should be “i ekil siht margorp yrev hcum”.

Reverse the whole string from start to end to get the desired output “much very program this like i” in the above example.

Below is the implementation of the above approach:

Similar questions