
Boustrophedon is a type of bidirectional text, mostly seen in ancient manuscripts and inscriptions.
Every other line of writing is reversed. Rather than always going left-to-right as in modern English, alternate lines in boustrophedon must be read in opposite directions. The individual character images on reversed lines are also mirrored.
Notice that some Latin letters are symmetrical and therefore do not need to be mirrored on the reversed lines. Thus, some English texts may be written as boustrophedons with the standard font. The symmetrical letters are: A, H, I, M, O, T, U, V, W, X, Y.
A boustrophedon must consist of at least lines. All lines of the boustrophedon must have the same number of characters (let us call this number the width of the boustrophedon), except the last line, which may be shorter. The text contains only uppercase English letters (no spaces or punctuation).
Your program must find the width of the widest boustrophedon that can be constructed from the given text and does not require any letter mirroring.
The input file contains a single string composed of uppercase Latin letters. The string length is between and characters.
Output a single integer—the maximum boustrophedon width. If there is no solution, output .
Example 1