UVa 272 - TEX Quotes


提交解答

分數: 1
時間限制: 3.0s
記憶體限制: 256M

作者:
題目代碼
題目類型

UVa 272 - TEX Quotes


Problem Description

TEX is a typesetting system developed by Donald Knuth. It is the precursor to LaTeX and is still widely used in mathematics and science.

One of the features of TEX is the way it handles quotation marks. It uses two backquotes (``) to open a quote and two apostrophes ('') to close a quote. This is different from the standard way of using the double-quote character (") on a keyboard, which is the same for both opening and closing quotes.

Your task is to write a program that reads a block of text and replaces each double-quote character (") with the appropriate TEX-style quotation marks. The first double-quote in the text should be replaced by `` (two backquotes), the second by '' (two apostrophes), the third by ``, the fourth by '', and so on, alternating between opening and closing quotes throughout the entire text.


Input

The input consists of several lines of text. The program should process the text until the end of the file (EOF). Each line may contain any number of double-quote characters ("), including none.

Output

The output should be the same text as the input, but with each double-quote character replaced by the appropriate TEX-style quotation marks as described above.


Sample Input
"To be or not to be," quoth the Bard, "that
is the question".
The cat "sat" on the "mat."
Sample Output
``To be or not to be,'' quoth the Bard, ``that
is the question''.
The cat ``sat'' on the ``mat.''

評論

目前沒有評論。