Problem Statement | |||||||||||||
Tanya has a rectangular table filled with letters. First, she makes four copies of this table, and arranges the copies as a 2×2 rectangle. Then she lists all subrectangles of the resulting table. For example, for the following original table: OK she will arrange the copies like this: OKOK OKOKand then she will list the following 30 subrectangles (dots for clarity only): OKOK .... OKOK OKO. .... OKO. .KOK .... .KOK OKOK OKOK .... OKO. OKO. .... .KOK .KOK .... OK.. .... OK.. .KO. .... .KO. ..OK .... ..OK OK.. OK.. .... .KO. .KO. .... ..OK ..OK .... O... .... O... .K.. .... .K.. ..O. .... ..O. ...K .... ...K O... O... .... .K.. .K.. .... ..O. ..O. .... ...K ...K .... (Note that she is considering all subrectangles based on their positions rather than their content, so the same subrectangle might appear multiple times in the list. In this case, subrectangle "K" appears four times because it occurs at four different positions.) Tanya wonders how frequently each letter of the alphabet occurs among all these subrectangles. You are given a String[] table, where the j-th character of the i-th element is the letter at row i, column j of the original table. Return a long[] containing exactly 26 elements, where the i-th element is the number of occurrences of the i-th letter in the alphabet among all of Tanya's subrectangles. 'A' is the 0-th letter, 'B' is the 1-st letter, etc. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | table will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of table will contain between 1 and 50 characters, inclusive. | ||||||||||||
- | Each element of table will contain the same number of characters. | ||||||||||||
- | Each element of table will contain only uppercase letters ('A'-'Z'). | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
|