1. 題目說明:
請開啟C:\ANS.CSF\JP02資料夾中的JPD02.java進行編寫。依下列題意進行作答:在指定字串中尋找關鍵字,計算此字串出現次數後輸出,使輸出值符合題意要求。檔案名稱請另存新檔為JPA02.java,儲存於C:\ANS.CSF\JP02資料夾,再進行評分。
2. 設計說明:
(1) 請撰寫程式,讓使用者輸入一個字串,尋找並計算此字串於常數dreams短文中出現的次數,輸出次數。
3. 輸入輸出:
輸入說明
一個字串
輸出說明
字串出現次數(輸出最後一行後不自動換行)
範例輸入1
to do
範例輸出1
2
範例輸入2
when yu miss
範例輸出2
0
"There are moments in life when you miss someone so much that "
+ "you just want to pick them from your dreams and hug them for real! Dream what "
+ "you want to dream; go where you want to go; be what you want to be, because you have "
+ "only one life and one chance to do all the things you want to do"; |