BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String str;
if((str=in.readLine())!=null){
String[] arr = str.split(","); /* 逗号分隔,split方法支持正则表达式 */
for(String s:arr){
System.out.println(s);
}
}
Scanner scanner = new Scanner(System.in);
if(scanner.hasNext()){
String ss = scanner.nextLine().split("\\W+");
for(String s: ss) System.out.println(s);
}