Given a String S , print the reverse of the string as output.
Example 1:
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 .
Example 2:
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 .
Your Task:  
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|)
Constraints:
1<= |S| <=1000

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Data structures

Starter code: #User function Template for python3

class Solution:

    def revStr (ob, S):

        # code here 

Solutions:
class Solution:

	def revStr(ob, S):
		return S[::-1]


class Solution:

	def revStr(ob, s):
		return s[::-1]


class Solution:

	def revStr(ob, S):
		res = ''
		for i in range(len(S) - 1, -1, -1):
			res += S[i]
		return res


class Solution:

	def revStr(ob, S):
		s = ''
		for i in S:
			s = i + s
		return s


class Solution:

	def revStr(ob, S):
		S = list(S)
		S[::1] = S[::-1]
		T = ''.join(S)
		return T


class Solution:

	def revStr(ob, S):
		a = list(S)
		s = ''
		b = a[::-1]
		for i in b:
			s = s + i
		return s


class Solution:

	def revStr(ob, S):
		x = ''.join(reversed(S))
		return x


class Solution:

	def revStr(ob, S):
		string = ''.join(reversed(S))
		return string


class Solution:

	def revStr(ob, S):
		output = ''
		for i in S:
			output = i + output
		return output


class Solution:

	def revStr(ob, S):
		n = ' '
		for i in S:
			n = i + n
		return n


class Solution:

	def revStr(ob, S):
		rev = ''
		for i in S:
			rev = i + rev
		return rev


class Solution:

	def revStr(ob, S):
		var = str(S)
		new_var = var[::-1]
		result = new_var
		return result


class Solution:

	def revStr(ob, S):
		s = ''
		for i in reversed(range(len(S))):
			s += S[i]
		return s


class Solution:

	def revStr(ob, S):
		l = []
		for i in S[len(S)::-1]:
			l.append(i)
		r = ''.join(l)
		return r


class Solution:

	def revStr(ob, S):
		n = len(S)
		arr = ''
		for i in range(n - 1, -1, -1):
			arr += S[i]
		return arr


class Solution:

	def revStr(ob, S):
		len1 = len(S)
		ans = ''
		for i in range(len1 - 1, -1, -1):
			ans += S[i]
		return ans


class Solution:

	def revStr(ob, S):
		S1 = ''
		for L in S:
			S1 = L + S1
		return S1


class Solution:

	def revStr(ob, S):
		start = 0
		end = len(S) - 1
		l = list(S)
		while start < end:
			temp = l[start]
			l[start] = l[end]
			l[end] = temp
			start += 1
			end -= 1
		str1 = ''
		for ele in l:
			str1 += ele
		return str1


class Solution:

	def revStr(ob, S):
		S = list(S)
		n = len(S)
		for i in range(n // 2):
			(S[i], S[n - 1 - i]) = (S[n - 1 - i], S[i])
		return ''.join(S)


class Solution:

	def revStr(ob, S):
		reverse = ''
		for m in S:
			reverse = m + reverse
		return reverse


class Solution:

	def revStr(ob, s):
		temp = ''
		n = len(s)
		for i in range(n - 1, -1, -1):
			temp += s[i]
		return temp