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.

//package cf;
import java.io.*;
import java.util.*;
public class Temp_Class {
    static int p=1000000007;

    public static void main(String[] args) throws Exception{
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
        FastReader sc=new FastReader();
        int t=1;
        StringBuilder sb=new StringBuilder();
        while(t-->0)
        {
            char ar[]=sc.nextLine().toCharArray();
            int n=ar.length;
            int left_end=0;
            int r_end=n-1;
            int chance=1;
            int tot=0,it=0;
            int pre[]=new int[n];
            for(int i=0;i<n;i++)
            {
                int c=1;
                int ind=i;
                while(i+1<n&&ar[i]!=ar[i+1])
                {
                    c++;
                    i++;
                }
                pre[i]=c;
            }
            //bwbwwbwb*bwbwwbwb
            long ans=Math.max(pre[n-1],1);
            int frst=-1,lst=-1;
            for(int i=0;i<n;i++)
            {
                if(frst==-1&&pre[i]!=0)
                    frst=i;
                if(pre[i]!=0)
                    lst=i;

            ans=Math.max(ans,pre[i]);
            }
            if(ar[0]!=ar[n-1]&&frst!=lst)
            {
                ans=Math.max(ans,pre[frst]+pre[lst]);
            }
            ans=Math.min(n,ans);
            //System.out.println(Arrays.toString(pre));
            /*for(int i=0;i<n&&ar[0]!=ar[n-1];i++)
            {
                int rev=pre[n-1]-pre[i];
                ans=Math.max(ans,pre[i-1]+rev+1);
            }*/
           // System.out.println(Arrays.toString(pre));
            System.out.println(ans);
            //bwbwwbw*bwbwwbw
            //wb|wbwwb
            //bwbwwwwbw*bwbwwwwbw
            //bwbbbbw*bwbbbbw
        }
        //bwbwwbwbw*bwbwwbwbw
       // System.out.println(sb.toString());
        out.flush();
    }
    public static int binary_Search_upper(int ar[],int x)
    {
        int res=-1;
        int l=0;int r=ar.length-1;
        while(l<=r)
        {
            int mid=(l+r)>>1;
            if(ar[mid]==x)
            {
                res=mid;
                l=mid+1;
            }
            else if(ar[mid]>x)
            {
                r=mid-1;
            }
            else
            {
                l=mid+1;
            }
        }
        return res;
    }
    public static int binary_Search_lower(int ar[],int x)
    {
        int res=-1;
        int l=0;int r=ar.length-1;
        while(l<=r)
        {
            int mid=(l+r)>>1;
            if(ar[mid]==x)
            {
                res=mid;
                r=mid-1;
            }
            else if(ar[mid]>x)
            {
                r=mid-1;
            }
            else
            {
                l=mid+1;
            }
        }
        return res;
    }
    int bit[]=new int[(int)1e6];
    public void update(int n,int val,int i)
    {
        i++;
        while(i<n)
        {
            bit[i]+=val;
            i+=(i)&(-i);
        }

    }
    public long query(int n,int i)
    {
        i++;
        long sum=0;
        while(i>0)
        {
            sum+=bit[i];
            i-=(i)&(-i);
        }
        return sum;
    }


    ///////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }


}
