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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long int dx[] = {0, 1, -1, 0};
long long int dy[] = {1, 0, 0, -1};
long long int N = (long long int)(2 * 1e5 + 10);
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  long long int l = s.length();
  if (l == 1) {
    cout << "1\n";
    exit(0);
  }
  char last;
  if (s[0] == 'b')
    last = 'b';
  else
    last = 'w';
  long long int c = 1;
  long long int a1 = 1;
  for (long long int i = 1; i < l; i++) {
    if (s[i] == last) {
      c = 1;
      continue;
    }
    if (s[i] == 'b')
      last = 'b';
    else
      last = 'w';
    c++;
    a1 = max(a1, c);
  }
  if (s[0] == 'b')
    last = 'b';
  else
    last = 'w';
  c = 1;
  long long int a2 = 1;
  for (long long int i = 1; i < l; i++) {
    if (s[i] == last) {
      c = 1;
      break;
    }
    if (s[i] == 'b')
      last = 'b';
    else
      last = 'w';
    c++;
    a2 = max(a2, c);
  }
  if (s[l - 1] == 'b')
    last = 'b';
  else
    last = 'w';
  c = 1;
  long long int a3 = 1;
  for (long long int i = l - 2; i >= 0; i--) {
    if (s[i] == last) {
      c = 1;
      break;
    }
    if (s[i] == 'b')
      last = 'b';
    else
      last = 'w';
    c++;
    a3 = max(a3, c);
  }
  long long int b1 = 0;
  for (long long int i = 0; i < l; i++) {
    if (s[i] == s[0])
      b1++;
    else
      break;
  }
  long long int b2 = 0;
  for (long long int i = l - 1; i >= 0; i--) {
    if (s[i] == s[l - 1])
      b2++;
    else
      break;
  }
  if (s[0] == s[l - 1] || a1 == l) {
    cout << max(a1, max(a2, a3));
    exit(0);
  }
  if (a2 == 1 || a3 == 1) {
    if (a1 == 1 && a2 == 1 && a3 == 1) {
      cout << "1";
      exit(0);
    }
    if (a2 == 1 && a3 == 1) {
      cout << a1;
      exit(0);
    }
    long long int x = max(a2, a3);
    cout << max(a1, x + 1);
    exit(0);
  }
  cout << max(a1, a2 + a3);
}