#K34982. Maximum Consecutive Ones with Flip and Shift

    ID: 25430 Type: Default 1000ms 256MiB

Maximum Consecutive Ones with Flip and Shift

Maximum Consecutive Ones with Flip and Shift

You are given an integer \( n \) representing the length of a binary string \( b \). You are allowed to perform any number of the following operations:

  • Flip: Change a '0' to '1' or vice versa.
  • Shift: Rotate the binary string.

Your task is to compute the maximum number of consecutive 1's that can be obtained after performing these operations any number of times. Since you can flip any 0's to 1's arbitrarily, the answer is always \( n \), i.e. the length of the binary string.

Note: The input is taken from stdin and the output should be printed to stdout.

inputFormat

The input consists of two lines:

  1. The first line contains an integer \( n \) (the length of the binary string).
  2. The second line contains the binary string \( b \) of length \( n \).

Input is read from stdin.

outputFormat

Output a single integer representing the maximum number of consecutive 1's that can be achieved after performing any number of Flip and Shift operations on the binary string.

Output should be written to stdout.

## sample
8
11000111
8