Created
February 18, 2011 12:30
-
-
Save stesh/833608 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int[] countLetters(String input) { | |
int[] results = new int[26]; | |
for (int i = 0; i < input.length(); i++) { | |
int cur = input.toLowerCase().charAt(i); | |
if (cur >= 'a' && cur <= 'z') {results[cur - 'a']++;} | |
} | |
return results; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment