Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Preparing an article
Time Limit: 1000MSMemory Limit: 65536K
Total Submissions: 612Accepted: 143

Description

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

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

Output will be an exact replica of the input, except the double quotes are to be modified according to the rules described above.

Sample Input

There is no "q in this sentence. \par 
"Talk child," said the unicorn. 

She s\"aid, "\thinspace `Enough!', he said." 
\endinput 

Sample Output

There is no q in this sentence. \par 
``Talk child,'' said the unicorn. 

She s\"aid, ``\thinspace `Enough!', he said.'' 
\endinput 

Hint

Double-quote (") has ASCII code 34,
left-single-quote (`) has ASCII code 96,
right-single-quote (') has ASCII code 39.

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator