Given a string consisting of lowercase letters, arrange all its letters in ascending order. 
Example 1:
Input:
S = "edcab"
Output: "abcde"
Explanation: characters are in ascending
order in "abcde".
Example 2:
Input:
S = "xzy"
Output: "xyz"
Explanation: characters are in ascending
order in "xyz".
Your Task:  
You don't need to read input or print anything. Your task is to complete the function sort() which takes the string as inputs and returns the modified string.
Expected Time Complexity: O(|S| * log |S|)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ |S| ≤ 10^{5}
S contains only lowercase alphabets.

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Sorting

Data structures

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

Solutions:
class Solution:

	def sort(self, s):
		return ''.join(map(str, sorted(s)))


class Solution:

	def sort(self, s):
		return ''.join(sorted(s))


class Solution:

	def sort(self, s):
		s = list(s)
		s.sort()
		return ''.join(s)


class Solution:

	def sort(self, s):
		str1 = ''
		for i in range(len(s)):
			str1 = str1 + s[i]
		res = ''.join(sorted(str1))
		return res


class Solution:

	def sort(self, s):
		s1 = sorted(s)
		f = ''.join(s1)
		return f


class Solution:

	def sort(self, s):
		result = sorted(s)
		sorted_String = ''.join(map(str, result))
		return sorted_String


class Solution:

	def sort(self, s):
		k = list(map(str, str(s)))
		k.sort()
		e = str(''.join(map(str, k)))
		return e


class Solution:

	def sort(self, s):
		a = [i for i in s]
		a.sort()
		return ''.join([str(elem) for elem in a])


class Solution:

	def sort(self, s):
		l = sorted(s)
		a = ''.join(l)
		return a


class Solution:

	def sort(self, s):
		a = sorted(list(s))
		return ''.join(a)


class Solution:

	def sort(self, s):
		l1 = []
		for i in s:
			l1.append(i)
		l1.sort()
		return ''.join(l1)


class Solution:

	def sort(self, s):
		l = []
		for i in s:
			l.append(ord(i))
		l.sort()
		new = ''
		for i in l:
			new += chr(i)
		return new


class Solution:

	def sort(self, s):
		l = []
		for i in s:
			l.append(i)
		l.sort()
		k = ''.join(l)
		return k


class Solution:

	def sort(self, s):
		a = sorted(s)
		x = ''
		for i in a:
			x += i
		return x


class Solution:

	def sort(self, s):
		l = []
		l[:0] = s
		l.sort()
		s1 = ''.join(l)
		return s1


class Solution:

	def sort(self, s):
		s1 = ''
		for i in range(97, 123):
			s1 += chr(i) * s.count(chr(i))
		return s1


class Solution:

	def sort(self, s):
		a = []
		for i in s:
			a.append(i)
		aa = a.sort()
		ss = ''
		for i in a:
			ss += i
		return ss


class Solution:

	def sort(self, s):
		m = list(s)
		p = sorted(m)
		return ''.join(p)


class Solution:

	def sort(self, s):
		b = list(s)
		b.sort()
		c = ''.join(b)
		return c


class Solution:

	def sort(self, s):
		s = sorted(s)
		p = ''
		for i in s:
			p += i
		return p


class Solution:

	def sort(self, s):
		max_char = 26
		count = dict()
		for c in s:
			if c not in count.keys():
				count[c] = 1
			else:
				count[c] += 1
		ac = ''
		for k in sorted(count.keys()):
			for _ in range(count[k]):
				ac = ac + k
		return ac


class Solution:

	def sort(self, s):
		li = [0 for i in range(26)]
		for i in range(len(s)):
			li[ord(s[i]) - 97] += 1
		s = ''
		for i in range(len(li)):
			if li[i] > 0:
				s = s + chr(i + 97) * li[i]
		return s


class Solution:

	def sort(self, s):
		b = sorted(s)
		str = ''
		for i in b:
			str += i
		return str


class Solution:

	def sort(self, s):
		s = list(s)
		s.sort()
		d = ''
		for i in s:
			d += i
		return d


class Solution:

	def sort(self, s):
		slist = list(s)
		slist.sort()
		news = ''.join(slist)
		return news


class Solution:

	def sort(self, s):
		str1 = ''
		s = list(s)
		s.sort()
		for i in s:
			str1 += i
		return str1


class Solution:

	def sort(self, s):
		f = [0] * 26
		for i in s:
			f[ord(i) - ord('a')] += 1
		ans = ''
		for i in range(26):
			while f[i] > 0:
				f[i] -= 1
				ans += chr(i + ord('a'))
		return ans


class Solution:

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


class Solution:

	def sort(self, s):
		l = list(s)
		l.sort()
		st = ''.join(l)
		return st


class Solution:

	def sort(self, s):
		a = list(s)
		b = sorted(a)
		c = ''.join(b)
		return c


class Solution:

	def sort(self, s):
		count = [0] * 256
		for i in range(len(s)):
			count[ord(s[i])] += 1
		str = ''
		for i in range(256):
			if count[i] != 0:
				for j in range(count[i]):
					str += chr(i)
		return str


class Solution:

	def sort(self, s):
		l = list(s)
		l.sort()
		s1 = ''
		for i in l:
			s1 += i
		return s1


class Solution:

	def sort(self, s):
		ans = ''
		S1 = sorted(s)
		for i in S1:
			ans = ans + i
		return ans


class Solution:

	def sort(self, s):
		new = ''
		a = [i for i in s]
		a.sort()
		for i in a:
			new = new + i
		return new


class Solution:

	def sort(self, s):
		sorted_s = [l for l in s]
		sorted_s.sort()
		return ''.join(sorted_s)


class Solution:

	def sort(self, s):
		res = sorted(s)
		res = ''.join((item for item in res))
		return res


class Solution:

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


class Solution:

	def sort(self, s):
		sort_string = sorted(s)
		sort = ''
		for i in sort_string:
			sort += i
		return sort


class Solution:

	def sort(self, s):
		list1 = list(s)
		list1.sort()
		st = ''.join(list1)
		return st


class Solution:

	def sort(self, s):
		p = sorted(str(s))
		q = ''.join(p)
		return q


class Solution:

	def sort(self, s):
		self.s = s
		k = sorted(s)
		p = ''.join(k)
		return p


class Solution:

	def sort(self, s):
		a = list(s)
		a.sort()
		st = ''
		return st.join(a)


class Solution:

	def sort(self, s):
		s = list(s)
		s.sort()
		k = ''
		for i in s:
			k = k + i
		return k