eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

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{&lt;} represents "\textbf{<}" (less), \textbf{&gt;} represents "\textbf{>}" (greater), \textbf{&amp;} represents "\textbf{&}" (ampersand), \textbf{&apos;} represents "\textbf{’}" (single quote), \textbf{&quot;} 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&lt;3&lt;4}" and \textbf{XMLEncode(XMLEncode(S))}will be "\textbf{2&amp;lt;3&amp;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 секунда
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
Everybody knows that 2 < 3.
Вихідні дані #1
0