import java.util.Scanner; class StringCharSort{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter a String:"); String str = sc.nextLine(); char ch[] = str.toCharArray(); for(int i=0;ifor(int j=1;j { if(ch[j-1]>ch[j]) { char temp = ch[j-1]; ch[j-1]=ch[j]; ch[j]=temp; } } } for(char c :ch) { System.out.print(c); } } }
0 comments:
Post a Comment