Given a number N, write a program to find a maximum number that can be formed using all of the digits of this number.
Note: The given number can be very large, so the input is taken as a String.
 
Example 1:
Input:
N = "38293367"
Output:
98763332 
Explanation:
98763332 is the largest number that
can be formed by rearranging the
digits of N.
Example 2:
Input:
N = "1203465"
Output:
6543210
Explanation:
6543210 is the largest number that
can be formed by rearranging the
digits of N.
 
Your Task:
You don't need to read input or print anything. Your task is to complete the function findMax() which takes a String N as input and returns the answer.
 
Expected Time Complexity: O(|N|)
Expected Auxiliary Space: O(constant)
 
Constraints:
1 <= |N| <= 10^{5}

Difficulty: EASY
Tags: Mathematics
Expected Time Complexity: O(|N|)
Expected Auxiliary Space: O(constant)

Starter code:
#User function Template for python3



class Solution:

    def findMax(self, N):

        # code here

Solutions:
class Solution:

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


class Solution:

	def findMax(self, N):
		N = sorted(N, reverse=True)
		N = ''.join(N)
		return N


class Solution:

	def findMax(self, N):
		b = sorted(N, reverse=True)
		c = ''
		for i in b:
			c += i
		return c


class Solution:

	def findMax(self, N):
		l = []
		for i in N:
			l.append(int(i))
		l.sort()
		l = l[::-1]
		ans = ''
		for j in l:
			ans += str(j)
		return ans


class Solution:

	def findMax(self, N):
		y = list(N)
		y.sort(reverse=True)
		max_num = int(''.join(y))
		return max_num


class Solution:

	def findMax(self, N):
		s = sorted(N)
		j = s[::-1]
		k = ''.join(j)
		return k


class Solution:

	def findMax(self, N):
		lis = []
		for i in N:
			lis.append(i)
		lis.sort()
		lis1 = lis[::-1]
		jo = ''.join(lis1)
		return jo


class Solution:

	def findMax(self, N):
		k = sorted(N)
		k = k[::-1]
		p = ''.join(k)
		return p


class Solution:

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


class Solution:

	def findMax(self, N):
		b = int(N)
		a = []
		for i in range(len(N)):
			a.append(N[i])
		a.sort(reverse=True)
		x = ''.join(a)
		return int(x)


class Solution:

	def findMax(self, N):
		t = str(N)
		lst = []
		for i in t:
			lst.append(i)
		lst.sort()
		x = lst[::-1]
		l = ''.join(x)
		return l


class Solution:

	def findMax(self, N):
		t = list(N)
		t.sort()
		t.reverse()
		N = ''.join(t)
		return N


class Solution:

	def findMax(self, N):
		x = list(N)
		x.sort(reverse=True)
		ans = ''
		for i in x:
			ans += i
		return ans


class Solution:

	def findMax(self, N):
		N = sorted(N)
		N = N[::-1]
		return ''.join(N)


class Solution:

	def findMax(self, N):
		l = list(N)
		l.sort()
		l = l[::-1]
		ans = ''
		for i in l:
			ans += i
		return ans


class Solution:

	def findMax(self, N):
		nums = []
		for x in N:
			nums.append(x)
		nums.sort()
		ans = ''
		for i in range(len(nums) - 1, -1, -1):
			ans += nums[i]
		return ans


class Solution:

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


class Solution:

	def findMax(self, N):
		s = list(N)
		s.sort()
		s.reverse()
		p = ''.join(s)
		return p


class Solution:

	def findMax(self, N):
		x = []
		y = ''
		for i in N:
			x.append(int(i))
		x.sort(reverse=True)
		for j in x:
			y += str(j)
		return y


class Solution:

	def findMax(self, N):
		k = sorted(N)[::-1]
		a = ''
		for i in k:
			a += i
		return a


class Solution:

	def findMax(self, N):
		a = [i for i in str(N)]
		a.sort(reverse=True)
		x = ''.join(a)
		return int(x)


class Solution:

	def findMax(self, N):
		s = list(N)
		s.sort()
		s = s[::-1]
		d = ''
		for i in s:
			d += i
		return d


class Solution:

	def findMax(self, N):
		str = ''
		l = list(N)
		l.sort()
		l.reverse()
		for i in l:
			str = str + i
		return str


class Solution:

	def findMax(self, N):
		n = list(str(N))
		b = sorted(n)[::-1]
		return ''.join(b)


class Solution:

	def findMax(self, N):
		list1 = list(N)
		list1.sort()
		list1.reverse()
		st = ''.join(list1)
		return st


class Solution:

	def findMax(self, N):
		(l, res) = (list(N), '')
		l.sort(reverse=True)
		for i in l:
			res += i
		return res


class Solution:

	def findMax(self, N):
		a = [int(i) for i in N]
		a.sort()
		b = a[::-1]
		t = str(''.join(list(map(str, b))))
		return int(t)


class Solution:

	def findMax(self, N):
		a = list(N)
		a.sort(reverse=True)
		return ''.join(a)


class Solution:

	def findMax(self, N):
		n = sorted(N)
		arr = list(n)
		arr = arr[::-1]
		return ''.join(arr)


class Solution:

	def findMax(self, N):
		K = []
		res = ''
		for i in N:
			K.append(int(i))
		K.sort(reverse=True)
		for i in K:
			res += str(i)
		return res


class Solution:

	def findMax(self, N: str) -> str:
		digits = {x: 0 for x in '9876543210'}
		for x in N:
			digits[x] += 1
		result = ''
		for digit in '9876543210':
			if digit in digits:
				result += digit * digits[digit]
		return result


class Solution:

	def findMax(self, N):
		s = ''
		l = sorted(N)
		l = l[::-1]
		for i in l:
			s += i
		return s


class Solution:

	def findMax(self, N):
		arr = list(N)
		arr.sort(reverse=True)
		st = ''.join(arr)
		return st


class Solution:

	def findMax(self, N):
		dic = {'0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0}
		for i in N:
			dic[i] += 1
		s = ''
		for i in range(9, -1, -1):
			k = dic[str(i)] * str(i)
			s = s + k
		return s


class Solution:

	def findMax(self, N):
		n = []
		n[:0] = N
		n.sort(reverse=True)
		b = ''
		return b.join(n)


class Solution:

	def findMax(self, N):
		l = list(N)
		l.sort()
		return ''.join(l[::-1])


class Solution:

	def findMax(self, N):
		l = []
		for i in range(len(N)):
			l.append(int(N[i]))
		l.sort(reverse=True)
		s = ''
		for i in l:
			s += str(i)
		return s


class Solution:

	def findMax(self, num):
		ans = ''
		b = sorted(num)
		n = len(b)
		for i in range(n - 1, -1, -1):
			ans += b[i]
		return ans


class Solution:

	def findMax(self, N):
		x = sorted(N)
		x.reverse()
		x = ''.join(x)
		return x


class Solution:

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


class Solution:

	def findMax(self, N):
		str1 = ''
		number = str(N)
		number = ''.join(sorted(number))
		number = list(number)
		x = number[::-1]
		for i in x:
			str1 = str1 + i
		return str1


class Solution:

	def findMax(self, N):
		m = sorted(N)
		return ''.join(reversed(m))


class Solution:

	def findMax(self, N):
		lst = list(N)
		lst.sort()
		lst.reverse()
		final = ''.join(lst)
		return final


class Solution:

	def findMax(self, N):
		N = list(str(N))
		Ans = ''.join(sorted(N))
		return Ans[::-1]


class Solution:

	def findMax(self, N):
		arr = list(N)
		str1 = ''
		arr.sort(reverse=True)
		str1 = str1.join(map(str, arr))
		return str1


class Solution:

	def findMax(self, N):
		a = sorted(N)
		a.reverse()
		return ''.join(a)


class Solution:

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


class Solution:

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


class Solution:

	def findMax(self, N):
		num2 = sorted(N)
		reverse_num2 = num2[::-1]
		joined_nums = int(''.join(reverse_num2))
		return joined_nums


class Solution:

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


class Solution:

	def findMax(self, N):
		s = list(N)
		s.sort()
		s.reverse()
		return ''.join(s)
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = input()
		ob = Solution()
		print(ob.findMax(N))


class Solution:

	def findMax(self, N):
		N = sorted(N)
		N = ''.join(N)
		K = N[::-1]
		return K
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = input()
		ob = Solution()
		print(ob.findMax(N))


class Solution:

	def findMax(self, N):
		a = sorted(N)
		b = ''.join(a)
		c = b[::-1]
		return c
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = input()
		ob = Solution()
		print(ob.findMax(N))


class Solution:

	def findMax(self, n):
		s = str(n)
		a = [x for x in s]
		a.sort()
		t = ''
		m = len(a)
		for x in range(m - 1, -1, -1):
			t += a[x]
		return int(t)
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = input()
		ob = Solution()
		print(ob.findMax(N))


class Solution:

	def findMax(self, N):
		N = list(N)
		N.sort(reverse=True)
		p = ''
		for i in N:
			p = p + i
		N = int(p)
		return N
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = input()
		ob = Solution()
		print(ob.findMax(N))


class Solution:

	def findMax(self, N):
		a = list(N)
		for i in range(len(a)):
			a[i] = int(a[i])
		a.sort(reverse=True)
		for i in range(len(a)):
			a[i] = str(a[i])
		ans = ''.join(a)
		return ans
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = input()
		ob = Solution()
		print(ob.findMax(N))


class Solution:

	def findMax(self, N):
		l = sorted(list(N))
		s = ''.join(l)
		return s[::-1]
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = input()
		ob = Solution()
		print(ob.findMax(N))


class Solution:

	def findMax(self, N):
		n = list(N)
		n.sort()
		n = n[::-1]
		return ''.join(n)


class Solution:

	def findMax(self, N):
		ls = sorted(N, reverse=True)
		res = ''.join(ls)
		return res


class Solution:

	def findMax(self, N):
		a = list(str(N))
		a.sort()
		a.reverse()
		s = ''.join(a)
		return s


class Solution:

	def findMax(self, N):
		l = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
		s = ''
		for i in N:
			l[int(i)] += 1
		for i in range(9, -1, -1):
			for j in range(l[i]):
				s += str(i)
		return s


class Solution:

	def findMax(self, N):
		st = str(N)
		l = [i for i in st]
		l.sort(reverse=True)
		ans = ''.join(l)
		return int(ans)


class Solution:

	def findMax(self, N):
		arr = []
		for ch in N:
			arr.append(int(ch))
		arr.sort(reverse=True)
		s = ''
		for x in arr:
			s += str(x)
		return s


class Solution:

	def findMax(self, N):
		n = str(N)
		N = ''.join(sorted(n, reverse=True))
		N = int(N)
		return N


class Solution:

	def findMax(self, N):
		d = {}
		for x in N:
			if x not in d:
				d[x] = 0
			d[x] += 1
		x = 9
		sub = ''
		while x >= 0:
			s = str(x)
			if s in d:
				sub += s * d[s]
			x -= 1
		return int(sub)


class Solution:

	def findMax(self, N):
		l = [x for x in str(N)]
		l.sort(reverse=True)
		z = ''.join(l)
		return int(z)


class Solution:

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


class Solution:

	def findMax(self, N):
		N = sorted(N, reverse=True)
		return ''.join(map(str, N))