>>232
public class Q232 {
private static final String sentence = "Do you love me?";

public static void main(String[] args) {
if (!sentence.matches(".*[\\.\\?!]")) {
System.err.println("英語の文章は、「.」 「!」 「?」で終わっているものとする");
System.exit(0);
}
String[] list = sentence.split("[\\.\\?!]")[0].split(" ");
int max = 0, totalLength = 0;
for (String str : list)
if (str.length() > max) max = str.length();
int[] wordLengthList = new int[max];
for (String str : list) {
totalLength += str.length();
wordLengthList[str.length() - 1]++;
}
System.out.printf("単語数: %d\n平均語長: %.2f\n語長\t単語数\n", list.length, (double) totalLength / list.length);
for (int i = 0; i < wordLengthList.length; i++)
System.out.printf("%d\t%d\n", i + 1, wordLengthList[i]);
}
}

実行結果
単語数: 4
平均語長: 2.75
語長単語数
10
22
31
41