import java.util.*;
public class Example5_11 {
    public static void main(String[] args) {
        String s = "I.love China,do you?";
        StringTokenizer token = new StringTokenizer(s, " .,");  // 使用自定义分隔符空格、逗号和句号
        int count = token.countTokens();
        while (token.hasMoreTokens()) {
            String temp = token.nextToken();
            System.out.print (temp+" ");
            System.out.println("还剩" + token.countTokens() + "个单词");
        }
        System.out.println("s共有单词：" + count + "个");
    }
}
