import java.io.IOException; import java.io.InputStreamReader; /** * Count the number of times the */ public class CharCount { public static void main(String[] args) throws IOException { // Wrap with object that will convert bytes to characters. InputStreamReader r = new InputStreamReader(System.in); int charInput = 0; // Repeatedly read the next character until EOF. while ( (charInput = r.read()) != -1 ) { // Cast input to char type to treat as letter. char c = (char)charInput; // Convert to lower case and ensure it's a letter. c = Character.toLowerCase(c); if (!(c >= 'a' && c <= 'z')) continue; // ... } } }