Ограничения: время – 250ms/500ms, память – 256MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод
Послать решение Blockly Посылки Темы Где Обсудить (0)
One kind of software that is becoming very popular is software for blog writting.
A typical blog
writting software will parse text into Hypertext Markup Language (HTML) that is suitable to display
content in widely used web browsers.
While you can write HTML, most content authors do not
have expertise using it, or do not feel comfortable writing using HTML tags. To make their lives
easier, you decided to offer a software with a simpler syntax, authors can write their content and
use “shortcuts” to achieve some markup textual effects when displaying it. To start, you decided to
implement “shortcuts” for two of the most used text decorations in a blog: bold text, and italic.
To write bold text, the author can write the asterisk ('\*') shortcut, for example, if the author
types: "\*This is bold\*", the software will render the HTML code "<b>This is bold</b>".
For italic, the author can write the underscore ('\_') shortcut, for example, if the author types:
"_This is italic_", the software will render the HTML code "<i>This is italic</i>".
To make the authors job easier, nesting of shortcuts is not allowed, this is no text enclosed in a
shortcut will have another shortcut.
Your job is to write the code that will take a document written with shortcuts and translate it
into proper HTML.
The first line contains a text written in shortcut. The shortcut text is a string
with at most 100 characters, containing only characters that are the letters from the english alphabet:
'a' to 'z' and 'A' to ’Z’, the underscore '\_', the asterisk '\*', the space character, and the punctuation
symbols: ',', ';', '.', '!', '?', '-', '(', and ')'.
It is guaranteed that if there will be an even number of
underscores and asterisks.
Print a single line containing the HTML code for the shortcut text given in the input.
```sample Sample Input 1
_This is italic_*This is bold*
```
```sample Sample Output 1
<i>This is italic</i><b>This is bold</b>
```
```sample Sample Input 2
*(Is,;*this.)*a!*_question?_*-*__
```
```sample Sample Output 2
<b>(Is,;</b>this.)<b>a!</b><i>question?</i><b>-</b><i></i>
```