a467. CPE:TEX Quotes (UVa 272)

簡單CPE

時間限制 2000 ms ・ 記憶體限制 256 MB

題目描述

將一般文字中的雙引號(ASCII 字元 ")轉換成 TeX 引號。整份輸入中的第 1、3、5……個雙引號要換成兩個反引號(``),第 2、4、6……個要換成兩個單引號('')。引號狀態會跨越換行,不考慮巢狀引號。其他字元必須保持不變。

輸入格式

輸入包含多行文字,讀到檔案結尾為止。整份文字中的雙引號總數為偶數。

輸出格式

輸出轉換後的文字,保留原有空白、換行及其他字元。

題目來源:UVa 272 — TEX Quotes,CPE 歷屆試題。 原題:https://onlinejudge.org/external/2/272.pdf

範例測資

範例輸入 1

"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!"

範例輸出 1

``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!''
請先登入後再提交程式碼

討論與題解

載入討論區…

更多