http://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=2176
這題用字串切割空白有split(只能切一個東西)StringTokenizer(能切許多特定的東西)
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
String str = scn.nextLine();
StringTokenizer st = new StringTokenizer(str, ",! ");
while (st.hasMoreElements()) {
System.out.print(st.nextToken());
}
System.out.println();
}
/* 題目:[C_ST31-易] 移除字串中的空白鍵和定位鍵
作者:1010
時間:西元 2016 年 7 月 */
}