当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2604:Preparing an article

题目描述
TeX is the leading typesetting system for mathematics, science, and engineering and has been adopted as standard by the American Mathematical Society. LaTeX was developed later by Leslie Lamport. It is based on TeX and provides a set of higher level commands for production of complex documents. In TeX or LaTeX, any text editor program may be used to enter and modify the input text. The source text contains the actual text as well as formatting commands beginning with \. Commands are delimited by any non-alphabetic character. One example of beautification by TeX is that it uses `` (two left-single-quotes) and '' (two right-single-quotes) to delimit quotations, rather than the mundane " (one double quote) which is provided by most keyboards. Keyboards typically do not have an oriented double-quote, but they do have a left-single-quote (`) and right-single-quote ('). TeX lets the user type two left-single-quotes (``) to create a left-double-quote and two right-single-quotes ('') to create a right-double-quote. Now, you have a text only file containing at most 250 lines at most 80 symbols each, as source or input, and you want to use TeX to beautify it. Rather than doing everything by hand, as the first step of automation you want to convert the quotes into the TeX format by using a program. This program will convert the text with double-quotes (") into an identical text except that double quotes have been replaced by the two-character sequences required by TeX for delimiting quotations with oriented double-quotes. The double-quote (") characters should be replaced appropriately by proper double single quotes depending on whether it is an opening or closing quotation mark. Question of nested quotations does not arise. The first " must be replaced by ``, the next by '', the next by ``, the next by '', and so on. An opening double quote must have its closing quote in the same paragraph. If a match is not found in the same paragraph for an opening quote, this quote has to be deleted. Paragraph ends in the source text are marked either by at least one blank line, or a \par command or both. Your program must also be careful about the \" command which is used to produce umlaut or dieresis (\"e leads to ë). These are to be left untouched.
输入解释
Input will consist of several lines of text containing a number of double quotes ("), as well as some TeX commands. End of input will be marked by an \endinput command.
输出解释
Output will be an exact replica of the input, except the double quotes are to be modified according to the rules described above.
输入样例
There is no "q in this sentence. \par 
"Talk child," said the unicorn. 

She s\"aid, "\thinspace `Enough!', he said." 
\endinput 
输出样例
There is no q in this sentence. \par 
``Talk child,'' said the unicorn. 

She s\"aid, ``\thinspace `Enough!', he said.'' 
\endinput 
提示
Double-quote (") has ASCII code 34,
left-single-quote (`) has ASCII code 96,
right-single-quote (') has ASCII code 39.

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2604

最后修改于 2020-10-29T06:36:56+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536