Given a String S , print the reverse of the string as output.
Input: S = "GeeksforGeeks" Output: "skeeGrofskeeG" Explanation: Element at first is at last and last is at first, second is at second last and second last is at second position and so on .
Input: S = "ReversE" Output: "EsreveR" Explanation: "E" at first and "R" at last and "e" at second last and "s" at second and so on .
You dont need to read input or print anything. Complete the function revStr() which takes S as input parameter and returns the reversed string .
Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(|S|)
1<= |S| <=1000
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?Yes