Write a method that computes how often each letter A-Z or a-z occurs in a string. Don't distinguish between upper- and lowercase letters. Return an array of length 26. The ith element contains the number of times that the letter 'a' + i or 'A' + i occurs in the string. The string may contain other characters that you should simply skip.

Complete the following file:


public class Letters { /** Counts the frequencies of letters A-Za-z in a string @param str a string @return an array of 26 counts. The i-th count is the number of occurrences of 'A' + i or 'a' + i. */ public int[] letterFrequencies(String str) { // Your work here } }