Restoration of an HTML file
Petya recently downloaded a corrupted HTML file. It resembles a typical HTML file, but there are mismatched tags. Your task is to remove the minimum number of opening and closing tags to correct the tag structure.
More specifically, the HTML file consists of arbitrary characters with ASCII codes ranging from **32** to **126**, as well as Linux-style line breaks (characters with code **10**). Tags are opened with: <**Tag Name Parameters**> and closed with: <**Tag Name**>. **Tag Name** is a string of uppercase and lowercase Latin letters, which are case-sensitive. **Tag Name** is separated from **Parameters** by at least one space (but not a line break). Parameters may contain any valid ASCII characters except **<**, **>**, and line breaks. Opening tags without parameters are also allowed and are formatted as: <**Tag Name**>.
An HTML file is considered correct if each opening tag can be matched with a closing tag later in the file such that the section of the file between these tags is also a correct HTML file. Similarly, each closing tag must match exactly one preceding opening tag. An HTML file with no tags is also correct. An opening tag matches a closing tag if they have the same tag name.
Input
The input file is a corrupted HTML file that needs correction. Its length does not exceed **10000** bytes. The number of opening and closing tags does not exceed **500**. The characters **<** and **>** appear only in opening and closing tags.
Output
Output a single integer - the minimum number of opening or closing tags that need to be removed to make the file a correct HTML file.