import javax.swing.JOptionPane;
public class LetterCounting
{
public static void main(String[] args)
{
//the inputted text
String input = JOptionPane.showInputDialog("Enter your sentence(s).");
//convert string to all lowercase
input = input.toLowerCase();
//integers of the number of each of the 26 letters of the alphabet
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int e = 0;
int f = 0;
int g = 0;
int h = 0;
int i = 0;
int j = 0;
int k = 0;
int l = 0;
int m = 0;
int n = 0;
int o = 0;
int p = 0;
int q = 0;
int r = 0;
int s = 0;
int t = 0;
int u = 0;
int v = 0;
int w = 0;
int x = 0;
int y = 0;
int z = 0;
//integer created for the length of characters in the sentence
int length = input.length();
//for statement that keeps running for the entire length of the sentence
for(int ix =0; ix<length; ix++)
{
//if statements asking for each letter, and if that letter is present increases the value of the letter integer
if(input.charAt(ix)=="a".charAt(0))
{
a++;
}
if(input.charAt(ix)=="b".charAt(0))
{
b++;
}
if(input.charAt(ix)=="c".charAt(0))
{
c++;
}
if(input.charAt(ix)=="d".charAt(0))
{
d++;
}
if(input.charAt(ix)=="e".charAt(0))
{
e++;
}
if(input.charAt(ix)=="f".charAt(0))
{
f++;
}
if(input.charAt(ix)=="g".charAt(0))
{
g++;
}
if(input.charAt(ix)=="h".charAt(0))
{
h++;
}
if(input.charAt(ix)=="i".charAt(0))
{
i++;
}
if(input.charAt(ix)=="j".charAt(0))
{
j++;
}
if(input.charAt(ix)=="k".charAt(0))
{
k++;
}
if(input.charAt(ix)=="l".charAt(0))
{
l++;
}
if(input.charAt(ix)=="m".charAt(0))
{
m++;
}
if(input.charAt(ix)=="n".charAt(0))
{
n++;
}
if(input.charAt(ix)=="o".charAt(0))
{
o++;
}
if(input.charAt(ix)=="p".charAt(0))
{
p++;
}
if(input.charAt(ix)=="q".charAt(0))
{
q++;
}
if(input.charAt(ix)=="r".charAt(0))
{
r++;
}
if(input.charAt(ix)=="s".charAt(0))
{
s++;
}
if(input.charAt(ix)=="t".charAt(0))
{
t++;
}
if(input.charAt(ix)=="u".charAt(0))
{
u++;
}
if(input.charAt(ix)=="v".charAt(0))
{
v++;
}
if(input.charAt(ix)=="w".charAt(0))
{
w++;
}
if(input.charAt(ix)=="x".charAt(0))
{
x++;
}
if(input.charAt(ix)=="y".charAt(0))
{
y++;
}
if(input.charAt(ix)=="z".charAt(0))
{
z++;
}
}
//Prints out all the letters
System.out.println("a:" + a);
System.out.println("b:" + b);
System.out.println("c:" + c);
System.out.println("d:" + d);
System.out.println("e:" + e);
System.out.println("f:" + f);
System.out.println("g:" + g);
System.out.println("h:" + h);
System.out.println("i:" + i);
System.out.println("j:" + j);
System.out.println("k:" + k);
System.out.println("l:" + l);
System.out.println("m:" + m);
System.out.println("n:" + n);
System.out.println("o:" + o);
System.out.println("p:" + p);
System.out.println("q:" + q);
System.out.println("r:" + r);
System.out.println("s:" + s);
System.out.println("t:" + t);
System.out.println("u:" + u);
System.out.println("v:" + v);
System.out.println("w:" + w);
System.out.println("x:" + x);
System.out.println("y:" + y);
System.out.println("z:" + z);
}
}