Given a string str containing only lower case alphabets, the task is to sort it in lexicographically-descending order. 
Example 1:
Input: str = "geeks"
Output: "skgee"
Explanation: It's the lexicographically-
descending order.
Ã¢â¬â¹Example 2:
Input: str = "for"
Output: "rof"
Explanation: "rof" is in
lexicographically-descending order.
Your Task:  
You don't need to read input or print anything. Your task is to complete the function ReverseSort() which takes the string str as inputs and returns the modified string.
Expected Time Complexity: O(|str|)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ |str| ≤ 10^{5}

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Data structures

Starter code: #User function Template for python3
class Solution:
    def ReverseSort(self, str): 
        # code here

Solutions:
class Solution:

	def ReverseSort(self, str):
		l = list(str)
		l.sort(reverse=True)
		return ''.join(l)


class Solution:

	def ReverseSort(self, str):
		s = sorted(str, reverse=True)
		return ''.join(s)


class Solution:

	def ReverseSort(self, str):
		return ''.join(sorted(str)[::-1])


class Solution:

	def ReverseSort(self, str):
		str1 = ''
		res = ''.join(sorted(str))
		for i in range(len(res) - 1, -1, -1):
			str1 = str1 + res[i]
		return str1


class Solution:

	def ReverseSort(self, str):
		res = sorted(str)
		ans = ''.join(res[::-1])
		return ans


class Solution:

	def ReverseSort(self, st):
		return ''.join(list(reversed(sorted(list(st)))))


class Solution:

	def ReverseSort(self, str):
		l = []
		for i in str:
			l.append(i)
		l.sort(reverse=True)
		return ''.join(l)


class Solution:

	def ReverseSort(self, str):
		str2 = ''
		str = sorted(str)
		for i in range(len(str)):
			str2 = str[i] + str2
		return str2


class Solution:

	def ReverseSort(self, str):
		a = []
		for i in str:
			a.append(i)
		a.sort()
		a.reverse()
		b = ''
		for i in a:
			b += i
		return b


class Solution:

	def ReverseSort(self, str):
		p = sorted(str, reverse=True)
		return ''.join(p)


import string

class Solution:

	def ReverseSort(self, str):
		z = []
		x = ''
		for i in str:
			z.append(ord(i))
		z.sort()
		z = z[::-1]
		for j in z:
			char = chr(j)
			x += char
		return x


class Solution:

	def ReverseSort(self, str):
		s = list(str)
		s = sorted(s)
		return ''.join(s[::-1])


class Solution:

	def ReverseSort(self, str):
		n = list(str)
		ans = ''
		n.sort(reverse=True)
		for i in n:
			ans += i
		return ans


class Solution:

	def ReverseSort(self, str):
		output = ''.join(sorted(str, reverse=True))
		return output


class Solution:

	def ReverseSort(self, str):
		sortedString = ''.join(sorted(str, reverse=True))
		return sortedString


class Solution:

	def ReverseSort(self, str):
		freq = [0] * 26
		for i in str:
			freq[ord(i) - ord('a')] = freq[ord(i) - ord('a')] + 1
		s = ''
		for i in range(25, -1, -1):
			if freq[i] > 0:
				s = s + chr(ord('a') + i) * freq[i]
		return s


class Solution:

	def ReverseSort(self, str):
		m = list(str)
		p = sorted(m)
		return ''.join(p[::-1])


class Solution:

	def ReverseSort(self, str):
		str = sorted(str)
		str = str[::-1]
		str1 = ''
		for i in str:
			str1 = str1 + i
		return str1


class Solution:

	def ReverseSort(self, str):
		freq = [0] * 26
		for i in str:
			freq[ord(i) - ord('a')] += 1
		ss = ''
		for i in range(25, -1, -1):
			while freq[i]:
				ss += chr(i + 97)
				freq[i] -= 1
		return ss


class Solution:

	def ReverseSort(self, str):
		srt_str = ''
		sr1 = sorted(str)
		sr2 = sr1[::-1]
		for i in range(len(sr2)):
			srt_str = srt_str + sr2[i]
		return srt_str


class Solution:

	def ReverseSort(self, str):
		s = list(str)
		s.sort(reverse=True)
		x = ''
		for i in s:
			x = x + i
		return x


class Solution:

	def ReverseSort(self, str):
		sorting_res = []
		for i in str:
			sorting_res.append(i)
		sort = sorted(sorting_res)
		string = ''.join(sort)
		output = string[::-1]
		return output


class Solution:

	def ReverseSort(self, str):
		str = list(str)
		str.sort()
		return ''.join(reversed(str))


class Solution:

	def ReverseSort(self, str):
		list_str = list(str)
		list_str.sort()
		rev = ''
		return rev.join(list_str[::-1])


class Solution:

	def ReverseSort(self, str):
		x = ''.join(sorted(s))
		return x[::-1]


class Solution:

	def ReverseSort(self, str):
		s1 = ''.join(sorted(s))
		return s1[::-1]


class Solution:

	def ReverseSort(self, str):
		lst = list(str)
		lst.sort()
		ans = ''
		for i in range(len(lst) - 1, -1, -1):
			ans = ans + lst[i]
		return ans


class Solution:

	def ReverseSort(self, str):
		k = sorted(str)
		s = ''.join(k[::-1])
		return s


class Solution:

	def ReverseSort(self, str):
		l = list(str)
		a = sorted(l)
		s = ''
		for i in a:
			s += i
		return s[::-1]


class Solution:

	def ReverseSort(self, str):
		chars = list(str)
		chars.sort(reverse=True)
		result = ''.join(chars)
		return result


class Solution:

	def ReverseSort(self, str):
		a = []
		for i in str:
			a.append(i)
		a.sort()
		a = a[::-1]
		return ''.join(a)


class Solution:

	def ReverseSort(self, str):
		l = []
		s = ''
		for i in str:
			l.append(i)
		l.sort(reverse=True)
		for j in l:
			s += j
		return s


class Solution:

	def ReverseSort(self, str):
		p = sorted(str)
		r = p[::-1]
		q = ''.join(r)
		return q


class Solution:

	def ReverseSort(self, str):
		a = list(str)
		a.sort()
		s = a[::-1]
		st = ''
		return st.join(s)


class Solution:

	def ReverseSort(self, str):
		new = sorted(str)
		a = new[::-1]
		return ''.join(a)


class Solution:

	def ReverseSort(self, str):
		s = list(str)
		x = s.sort(reverse=True)
		return ''.join(s)


class Solution:

	def ReverseSort(self, stri):
		a = list(stri)
		a.sort(reverse=True)
		s = ''
		for i in a:
			s = s + i
		return s


class Solution:

	def ReverseSort(self, str):
		descending = sorted(str, reverse=True)
		return ''.join(descending)


class Solution:

	def ReverseSort(self, str):
		l = list(str)
		l.sort()
		x = ''.join(l[::-1])
		return x


class Solution:

	def ReverseSort(self, str):
		a = sorted(str)
		b = a[::-1]
		s = ''
		for i in b:
			s += i
		return s


class Solution:

	def ReverseSort(self, str):
		a = list(str)
		a.sort()
		b = ''.join(a)
		return b[::-1]


class Solution:

	def ReverseSort(self, str):
		l = list(str)
		l.sort()
		a = ''
		for i in range(len(l)):
			a = l[i] + a
		return a


class Solution:

	def ReverseSort(self, str):
		b = sorted(str)
		a = b[::-1]
		return ''.join(a)


class Solution:

	def ReverseSort(self, str):
		result = sorted(str)
		result1 = result[::-1]
		return ''.join(result1)


class Solution:

	def ReverseSort(self, str):
		s = ''.join(reversed(sorted(str)))
		return s


class Solution:

	def ReverseSort(self, str):
		l = []
		s = ''
		for i in str:
			l.append(i)
		l = sorted(l, reverse=True)
		for i in l:
			s = s + i
		return s


class Solution:

	def ReverseSort(self, str):
		s = ''
		l = list(str)
		l.sort()
		l = l[::-1]
		for i in l:
			s += i
		return s


class Solution:

	def ReverseSort(self, str):
		k = sorted(str)
		a = k[::-1]
		return ''.join(a)


class Solution:

	def ReverseSort(self, x):
		x = sorted(x)
		s = str()
		for i in x:
			s = s + i
		return s[::-1]


class Solution:

	def ReverseSort(self, str):
		str = list(str)
		s2 = []
		for i in range(len(str)):
			if str[i].islower():
				s2.append(str[i])
		s2 = sorted(s2)
		s2 = ''.join(s2)
		return s2[::-1]