A very good starting point to find your problem is to use the exception that was thrown.
Please type in a sentence and press [ENTER] : lets go
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String ind
ex out of range: 4
at java.lang.String.charAt(String.java:558)
at charCount.main(charCount.java:30)
. . .
Here it says that the problem is in the main method of the charCount class. It is at or near line 30 in the charCount.java file.
Somewhere near there is a call to the charAt() method, with an index request of 4 -- it throws this exception because the
string that is taking the charAt() of, has a length of less than 5.
Henry