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.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author nirav
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scan in = new Scan(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CPlasticineZebra solver = new CPlasticineZebra();
        solver.solve(1, in, out);
        out.close();
    }

    static class CPlasticineZebra {
        public void solve(int testNumber, Scan in, PrintWriter out) {
            String str = in.scanString();
            StringBuilder st = new StringBuilder(str);
            int t = -1;
            int i;

            int ans = 0;
            while (st.charAt(0) != st.charAt(st.length() - 1)) {
                for (i = 0; i < st.length(); i++) {
                    if (t == -1) {
                        t = st.charAt(i);
                    } else if (t != st.charAt(i)) {
                        t = st.charAt(i);
                    } else {
                        break;
                    }
                }
                int j;
                t = -1;
                for (j = st.length() - 1; j >= 0 && j >= i; j--) {
                    if (t == -1) {
                        t = st.charAt(j);
                    } else if (t != st.charAt(j)) {
                        t = st.charAt(j);
                    } else {
                        break;
                    }
                }
                if (j < i) {
                    StringBuilder tem = new StringBuilder(st.substring(0, i));
                    tem.reverse();
                    tem.append(new StringBuilder(st.substring(i, st.length())).reverse());
                    st = new StringBuilder(tem);
                    if ((i + st.length() - 1 - j) > ans) {
                        ans = (i + st.length() - 1 - j);
                    }
                    break;
                } else {
                    StringBuilder tem = new StringBuilder(st.substring(0, i));
                    tem.reverse();
                    tem.append(new StringBuilder(st.substring(i, st.length())).reverse());
                    st = new StringBuilder(tem);
                    if ((i + st.length() - 1 - j) > ans) {
                        ans = (i + st.length() - 1 - j);
                    }
                }
            }
            t = -1;
            int count = 0;
            for (int j = 0; j < st.length(); j++) {
                if (t == -1) {
                    t = st.charAt(j);
                    count++;
                    if (ans < count) {
                        ans = count;
                    }
                } else if (t != st.charAt(j)) {
                    t = st.charAt(j);
                    count++;
                    if (ans < count) {
                        ans = count;
                    }
                } else {
                    count = 0;
                    t = st.charAt(j);
                    count++;
                    if (ans < count) {
                        ans = count;
                    }
                }
            }
            out.println(ans);

        }

    }

    static class Scan {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public Scan(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        public String scanString() {
            int c = scan();
            while (isWhiteSpace(c)) c = scan();
            StringBuilder RESULT = new StringBuilder();
            do {
                RESULT.appendCodePoint(c);
                c = scan();
            } while (!isWhiteSpace(c));
            return RESULT.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}