If you only want letters to be counted (say, ignore numbers, spaces, and other characters) test to see if the character is a letter before adding it to the list:


for (int i = 0; i < str.length;...