Олимпиадный тренинг

Задача 34978. Fixing the XML


Задача

Темы: Стек
The XML format is a common way to exchange data between different programs. Recently, the programmer Ivanov wrote a small program that saves some important information as an XML string.

An XML string consists of opening and closing tags.

An opening tag begins with an opening angle bracket (<), followed by the tag name — a non-empty lowercase English string followed by a closing angle bracket (>).
Examples of opening tags: <a>, <dog>.

The end tag begins with an opening angle bracket, followed by a forward slash (/), then the tag name — a non-empty string of lowercase Latin letters followed by a closing angle bracket.
Examples of closing tags: </a>, </dog>.

An XML string is  correct if it can be obtained according to the following rules:
  • An empty string is a valid XML string.
  • A and B — valid XML strings, then the string AB obtained by appending string B to the end of string A is also a valid XML string.
  • If A — a valid XML string, then the string <X>A</X>, obtained by prepending A the opening tag, and at the end — closing with the same name is also a valid XML string. Here X — any non-empty string of lowercase Latin letters.
For example, the following lines:
<a></a>
<a><ab></ab><c></c></a>
<a></a><a></a><a></a>
are valid XML strings, and strings such as:
<a></b>
<a><b>
<a><b></a></b>
are not valid XML strings.

Ivanov sent the file with the saved XML string by e-mail to his colleague Petrov. Unfortunately, however, the file got corrupted during the transfer: exactly one character in the string was replaced by some other character.
It is required to write a program that, based on the string that Petrov received, will restore the original XML string that Ivanov sent.

Input: The input file contains a single string that can be made into a valid XML string by replacing exactly one character. The string length is between 7 and 1000, inclusive. The string contains only lowercase Latin letters and the characters "<" (ASCII code 60), ">"(ASCII code 62), and "/"(ASCII code 47).
A line in the input file ends with a newline.

Output: The output file must contain a valid XML string that can be obtained from a string in the input file by replacing exactly one character with another. If there are several answers, you can display any one.
 
Examples
# Input Output
1 <a></b> <a></a>
2 <a><aa> <a></a>
3 <a><>a> <a></a>
4 <a/</a> <a></a>