Aggreko interview question

Q1. Write a program to reverse the word of a given string.

Interview Answer

Anonymous

13 Mar 2021

Ans1: They provided me the link I went there and then they told me to share my screen then. I wrote the code. In which I am taking input in a string and initialize another string to store the answer. Then I start a for loop in which I am storing a space in ans string Then I initilized 2nd string. And I am checking and storing data on thn ans string. If any space comes in the string thn it will go back to the index zero and every time there is an string is inserting all the string shift right side.