Arrange the alphabets in an ascending order
Problem to arrange the alphabets in an ascending order.
Example-1:
Input : S = "crazy" Output : "acryz"
Example-2:
Input : S = "coding" Output : "cdgino"
Solution
import java.util.*; public class Main { public static void main(String [] args) { String s = "mycrazycoding"; char ch [] = s.toCharArray(); Arrays.sort(ch); System.out.print(ch); } }
n = "mycrazycoding" a = sorted(n) print("".join(a))
Output
accdgimnoryyz