eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Wikipidia

Wikipidia

\textit{This problem statement uses Cyrillic quotation marks <<and>> instead of "and" in order to not get confused with apostrophes used in the problem.} Ben is working on his new project of non-traditional encyclopedia with the code name "Wikipidia". Now he is going to write the engine for translating wiki pages to html pages. However, he doesn't have enough time, because he is busy with promoting the project. So he hired you to write the engine. \includegraphics{https://static.e-olymp.com/content/c7/c75ba37fddfe23632178c5232347e8b57e267bb2.jpg} \includegraphics{https://static.e-olymp.com/content/11/118e2f38adafaeb7640f1dadc4a90eee62ea7821.jpg} First your engine must only support bold and italic. In wiki bold is surrounded with three apostrophes (<<\textbf{'''}>>), italic is surrounded with two apostrophes (<<\textbf{''}>>). In \textbf{HTML} bold is surrounded with and italic is surrounded with\textit{\textbf{ }}. In both wiki and \textbf{HTML} the sequence of bold and italic start/end markers must be well formed and non-recursive - if we replace bold start marker with <<\textbf{(}>>, bold end marker with <<\textbf{)}>>, italic start marker with <<\textbf{\[}>> and italic end marker with<<\textbf{\]}>>, we must get a regular brackets sequence, such that no round bracket is inside other round brackets, neither a square bracket is inside other square brackets. Unlike in \textbf{HTML} in wiki it is sometimes difficult to understand how to apply formatting, because sequences of \textbf{5} and more apostrophes can be interpreted in different ways. However, your programming abilities are strong, so you must be able to write the translation engine. \InputFile The input file contains one line that contains a sample wikipidia article that contains only letters, punctuation marks (<<\textbf{,}>>, <<\textbf{.}>>, <<\textbf{-}>>, <<\textbf{?}>>, <<\textbf{!}>>,), spaces and apostrophes used to denote bold/italic formatting. The size of the input article doesn't exceed \textbf{100000} bytes. \OutputFile Output the translated version of the article. The output file must not contain apostrophes. \includegraphics{https://static.e-olymp.com/content/c7/c75ba37fddfe23632178c5232347e8b57e267bb2.jpg} \includegraphics{https://static.e-olymp.com/content/11/118e2f38adafaeb7640f1dadc4a90eee62ea7821.jpg} \includegraphics{https://static.e-olymp.com/content/87/8755b6398fb0782fc85ebd598d1d830fcff1624c.jpg} \includegraphics{https://static.e-olymp.com/content/4a/4a85f47e0997bc042295627de4ab395d5344ce01.jpg} \includegraphics{https://static.e-olymp.com/content/4d/4d2d5b3466391ab197cfeb53286d4d08446f8897.jpg} \includegraphics{https://static.e-olymp.com/content/10/10fa67ba2cf3e0d32098230b930f2e655dacbfb9.jpg} To check your answer, the verifying program will make sure that the sequence of and tags is well formed and non-recursive, and translate your output back to wiki by replacing and with three apostrophes and \textit{and }with two apostrophes. The result must exactly coincide with the input text. If the input article cannot be correctly translated, output <<\textbf{!@#\$\%}>> instead.
Ліміт часу 1 секунда
Ліміт використання пам'яті 256 MiB
Вхідні дані #1
'''''This is''' sample article.''
Вихідні дані #1
<i><b>This is</b> sample article.</i>
Автор Andrew Stankevich
Джерело Andrew Stankevich Contest 32, Petrozavodsk Summer Training Camp, Wednesday, September 3, 2008