CPE 一顆星選集 49 道必考題
題目連結:https://zerojudge.tw/ShowProblem?problemid=c007
內容
給定若干列文字,將每組雙引號的第一個用``代替、第二個用’’代替。
範例輸入
“To be or not to be,” quoth the Bard, “that is the question”.
The programming contestant replied: “I must disagree.
To `C’ or not to `C’, that is The Question!”
範例輸出
``To be or not to be,’’ quoth the Bard, ``that is the question’’.
The programming contestant replied: ``I must disagree.
To `C’ or not to `C’, that is The Question!’’
想法
使用 getline 一次讀取一列,接著遍歷,遇到雙引號就判斷,其餘則直接輸出。
程式碼
C++
1 |
|