Informative Programming tricks Software Tricks Useful

Which English Letter has Maximum Words ?

Once I thought, “Maximum number of English words starts with which letter” ? I searched in internet. But I could not get complete information anywhere. Finally I thought to write a program which will calculate the number of words starting with each letter. To do this I first needed a complete list of all English words in a text file. I searched it and downloaded the file which contains all English words.

Then I started writing a JAVA program to calculate the English words starting with each letter. Here is the result I am showing you.

This graph shows number of words starting with each letter
This graph shows number of words starting with each letter

Number of English words starting with each letter in descending order


LettersNo. of wordsPercentage
s2533310.6%
p2447210.3%
c198518.37%
a168697.11%
u165206.97%
t129765.47%
m125035.27%
b111174.69%
d111074.68%
r99184.18%
h91053.84%
i88193.72%
e87483.69%
LettersNo. of wordsPercentage
o78773.32%
f71523.01%
g69692.94%
n67582.85%
l63222.66%
w40741.71%
v34161.44%
k22340.94%
j16370.69%
q11790.49%
z9630.40%
y6800.28%
x3840.16%

How to calculate ?


You need to download the following file for complete list of English words.


JAVA program to calculate
/*--------------Written by www.funbutlearn.com---------------*/
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class Dictionary {

public static void main(String[] args) throws IOException {
BufferedReader inputStream = new BufferedReader(new FileReader("D:/Dictionary.txt"));
String l;
int[] count = new int[26];
char[] letter={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
while ((l=inputStream.readLine())!=null){
switch(l.charAt(0)){
case 'a':count[0]=count[0]+1;break;
case 'b':count[1]=count[1]+1;break;
case 'c':count[2]=count[2]+1;break;
case 'd':count[3]=count[3]+1;break;
case 'e':count[4]=count[4]+1;break;
case 'f':count[5]=count[5]+1;break;
case 'g':count[6]=count[6]+1;break;
case 'h':count[7]=count[7]+1;break;
case 'i':count[8]=count[8]+1;break;
case 'j':count[9]=count[9]+1;break;
case 'k':count[10]=count[10]+1;break;
case 'l':count[11]=count[11]+1;break;
case 'm':count[12]=count[12]+1;break;
case 'n':count[13]=count[13]+1;break;
case 'o':count[14]=count[14]+1;break;
case 'p':count[15]=count[15]+1;break;
case 'q':count[16]=count[16]+1;break;
case 'r':count[17]=count[17]+1;break;
case 's':count[18]=count[18]+1;break;
case 't':count[19]=count[19]+1;break;
case 'u':count[20]=count[20]+1;break;
case 'v':count[21]=count[21]+1;break;
case 'w':count[22]=count[22]+1;break;
case 'x':count[23]=count[23]+1;break;
case 'y':count[24]=count[24]+1;break;
case 'z':count[25]=count[25]+1;break;
}
}
for(int j=0;j<26;j++){
for(int k=j+1;k<26;k++){
if(count[k]>count[j]){
int temp=count[k];
count[k]=count[j];
count[j]=temp;
char char1=letter[k];
letter[k]=letter[j];
letter[j]=char1;
}
}
}
for(int k=0;k<26;k++){
System.out.println(letter[k]+","+count[k]+","+((Double)((count[k]/236983.0)*100)).toString().substring(0, 4)+"%");
}
}
}
/*--------------Written by www.funbutlearn.com---------------*/

There another very similar article you must read

Leave a Reply

Your email address will not be published. Required fields are marked *