Not so trivial problem
In XML some characters are strictly predefined and have special meanings. For instance, character "<" 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 "entity_name;". There are five predefined entities: lt; represents "<" (less), gt; represents ">" (greater), amp; represents "" (ampersand), apos; represents "’" (single quote), quot; represents """(double quote). Let us call described transformation as function XMLEncode(S), where S is an input string. XMLEncode() could be applied to input several times.
For example, let S be equals to "2<3<4". Then XMLEncode(S) will be "2lt;3lt;4" and XMLEncode(XMLEncode(S)) will be "2amp;lt;3amp;lt;4".
Write a program that, by the resulting string R, will determine the maximum number of XMLEncode-function calls.
Input
The single line of input file contains the string R (1 ≤ length(R) ≤ 100000). The string can contain characters with ASCII codes from 32 to 127.
Output
The output file should contain a single integer – number of XMLEncode-function calls, or -1 if the string could be encoded infinitely.