Many markup languages are in use for text formatting today, among them HTML and TEX. A markup language provides a way to define formatted text in a readable ASCII file using tags, or codes, to denote formatting. In this problem, assume that our markup language, ACMML, uses tags in pairs, of the form <XXX+> and <XXX>, in that order, to surround text. When these tags surround text, they represent text formatted with whatever aftribute XXX indicates. For example, if BOL indicates bold and ITA indicates italic, the ACMML source text
This is how ACMML encodes <BOL+>bol<ITA+>d<BOL> a<ITA>nd <ITA+>italic<ITA> text.
represents the formatted text
This is how ACMML encodes bold and italic text.
The same formatted text can also be represented by this longer ACMML source text:
This is how ACM<BOL+><BOL>ML encodes <BOL+>bol<ITA+>d <ITA><ITA+><BOL> a<ITA>nd <ITA+><ITA+>ita<ITA>lic<ITA> text.
You will need to write a program to optimize ACMML source text.
INPUT: ACMML source text defining some formatted text.
OUPUT: ACMML source text defining the same formatted text, but containing the smallest possible number of pairs of tags.
This is how ACM<BOL+><MXY+><BOL><MXY>ML encodes <BOL+>bol<ITA+>d <ITA><ITA+><BOL> a<ITA>nd <ITA+><ITA+>ita<ITA>lic<ITA> text.
This is how ACMML encodes <BOL+>bol<ITA+>d<BOL> a<ITA>nd <ITA+>italic<ITA> text.