Alphabet Frequency

// Frequency of Alphabets

import java.io.*;
class FREQUENCY
{
public static void main()throws IOException
{
InputStreamReader y=new InputStreamReader(System.in);
BufferedReader x=new BufferedReader(y);
String s=new String();
int l,i,j,c=0;
System.out.println(“Enter a String:”);
s=x.readLine();
s=s.toUpperCase();
l=s.length();

for(i=65;i<=90;i++)
{
for(j=0;j0)
System.out.println(“Alphabet ” + (char)i + ” appears ” + c + ” time(s)”);
c=0;
}
}
}

Advertisements

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