Задачи
Not so trivial problem
Not so trivial problem
In XML some characters are strictly predefined and have special meanings. For instance, character "\textbf{<}" is used for the beginning of start-tags and end-tags. XML provides facilities for including text with special characters. Text is transformed as follows: each special character is replaced by the predefined entity "\textbf{&entity_name;}". There are five predefined entities: \textbf{<} represents "\textbf{<}" (less), \textbf{>} represents "\textbf{>}" (greater), \textbf{&} represents "\textbf{&}" (ampersand), \textbf{'} represents "\textbf{’}" (single quote), \textbf{"} represents "\textbf{"}"(double quote). Let us call described transformation as function \textbf{XMLEncode(S)}, where \textbf{S} is an input string. \textbf{XMLEncode()} could be applied to input several times.
For example, let \textbf{S} be equals to "\textbf{2<3<4}". Then \textbf{XMLEncode(S)} will be "\textbf{2<3<4}" and \textbf{XMLEncode(XMLEncode(S))}will be "\textbf{2&lt;3&lt;4}".
Write a program that, by the resulting string \textbf{R}, will determine the maximum number of XMLEncode-function calls.
\InputFile
The single line of input file contains the string \textbf{R} (\textbf{1} ≤ \textbf{length(R)} ≤ \textbf{100000}). The string can contain characters with ASCII codes from \textbf{32} to \textbf{127}.
\OutputFile
The output file should contain a single integer -- number of XMLEncode-function calls, or \textbf{-1} if the string could be encoded infinitely.
Входные данные #1
Everybody knows that 2 < 3.
Выходные данные #1
0