Power#735

Power

1 second
256 megabytes
Hard

Let a sequence of bytes be given, where each byte defines a subset of a group of objects. Different bytes correspond to different, non-overlapping groups of objects. The groups are numbered in the same order as the sequence of bytes. Objects within each group are also numbered starting from zero. Thus, there is a one-to-one correspondence between the objects within a group and the binary positions of the corresponding byte. An object is included in the subset if the corresponding bit in the byte is set to one; otherwise, it is not included.

We are interested in the unions of sets corresponding to consecutive groups.

It is required to determine the nonzero cardinality (the number of elements) which occurs most frequently among the cardinalities of the unions of subsets for consecutive ranges that have the property: the cardinality equals four times the length (in bytes) of the range. Among candidates with the same frequency, choose the largest number.

Recall that the cardinality of a finite set is the number of its elements.

Input

The input consists of a string representing the sequence of bytes. Each byte corresponds to two consecutive characters, which specify a two-digit hexadecimal number—the value of the corresponding byte. The string has even length and does not exceed characters.

Output

Output a single integer—the required cardinality.

Examples

Example 1

Loading
Loading