Alpha Sort

import java.io.*;
class AlphaSort
{
public static void main()throws IOException
{
InputStreamReader x=new InputStreamReader(System.in);
BufferedReader y=new BufferedReader(x);
String str, sortstr=””;
char ch;
System.out.println(“Enter any String in block letters without spaces”);
str=y.readLine();
str=str.toUpperCase();
int i,j,len;
len=str.length();

for(i=65;i<90;i++)
{
for(j=0;j<len;j++)
{
ch=str.charAt(j);
if(ch==i)
sortstr=sortstr+ch;
}
}
System.out.println(sortstr);

}
}

Advertisements
Comments
  1. Nikhil Nilesh says:

    Thanku sir very useful

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s