Problem: Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras. 

Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now wants to select several consequent (contiguous) pieces of alternating colors to create a zebra. Let's call the number of selected pieces the length of the zebra.

Before assembling the zebra Grisha can make the following operation 0 or more times. He splits the sequence in some place into two parts, then reverses each of them and sticks them together again. For example, if Grisha has pieces in the order "bwbbw" (here 'b' denotes a black strip, and 'w' denotes a white strip), then he can split the sequence as bw|bbw (here the vertical bar represents the cut), reverse both parts and obtain "wbwbb".

Determine the maximum possible length of the zebra that Grisha can produce.

Input

The only line contains a string s (1 ≤ |s| ≤ 10^5, where |s| denotes the length of the string s) comprised of lowercase English letters 'b' and 'w' only, where 'w' denotes a white piece and 'b' denotes a black piece.

Output

Print a single integer — the maximum possible zebra length.

Examples

Input

bwwwbwwbw


Output

5


Input

bwwbwwb


Output

3

Note

In the first example one of the possible sequence of operations is bwwwbww|bw → w|wbwwwbwb → wbwbwwwbw, that gives the answer equal to 5.

In the second example no operation can increase the answer.

Solution (in JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Iterator;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author MaxHeap
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    TaskC solver = new TaskC();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskC {

    public void solve(int testNumber, InputReader in, PrintWriter out) {
      StringBuilder sb = new StringBuilder(in.next());
      char[] s = sb.toString().toCharArray();
      if (s.length == 1) {
        out.println(1);
        return;
      }
      int i = 1;
      IntList cuts = new IntList(s.length);
      while (i < s.length) {
        if (s[i] == s[i - 1]) {
          if (s[0] != s[s.length - 1]) {
            ArrayUtils.reverse(s, i, s.length - 1);
            ArrayUtils.reverse(s, 0, i - 1);
          }
        }
        ++i;
      }
      int[] dp = new int[s.length];
      dp[0] = 1;
      for (int j = 1; j < s.length; j++) {
        if (s[j - 1] != s[j]) {
          dp[j] = dp[j - 1] + 1;
        } else {
          dp[j] = 1;
        }
      }
      out.println(ArrayUtils.max(dp));
    }

  }

  static class ArrayUtils {

    public static int max(int[] arr) {
      int val = arr[0];
      for (int i = 1; i < arr.length; i++) {
        if (arr[i] > val) {
          val = arr[i];
        }
      }
      return val;
    }

    public static void reverse(char[] arr, int from, int to) {
      int i = from;
      int j = to;
      while (i < j) {
        char temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
        i++;
        j--;
      }
    }

  }

  static class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1 << 13];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (this.numChars == -1) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return -1;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public String next() {
      int c;
      while (isSpaceChar(c = this.read())) {
      }

      StringBuilder result = new StringBuilder();
      result.appendCodePoint(c);

      while (!isSpaceChar(c = this.read())) {
        result.appendCodePoint(c);
      }

      return result.toString();
    }

    public static boolean isSpaceChar(int c) {
      return c == 32 || c == 10 || c == 13 || c == 9 || c == -1;
    }

  }

  static class IntList implements Iterable<Integer> {

    private int[] arr;
    public int length;
    public int pt;

    public IntList(int size) {
      this.length = size;
      this.arr = new int[size];
      pt = 0;
    }

    public int get(int index) {
      checkIndex(index);
      return arr[index];
    }

    private void checkIndex(int index) {
      if (index >= length || index < 0) {
        throw new IndexOutOfBoundsException();
      }
    }

    public String toString() {
      return Arrays.toString(arr);
    }

    public Iterator<Integer> iterator() {
      return new IntListIterator(this);
    }

    private class IntListIterator implements Iterator<Integer> {

      private IntList list;
      private int pt = 0;

      public IntListIterator(IntList list) {
        this.list = list;
      }

      public boolean hasNext() {
        return pt < list.pt;
      }

      public Integer next() {
        return list.get(pt++);
      }

    }

  }
}