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.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.Arrays;
import java.util.InputMismatchException;

/**
 * @author thesparkboy
 *
 */
public class temp {

	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		OutputWriter out = new OutputWriter(System.out);
		char[] c = in.readString().toCharArray();
		int n = c.length;
		int max = 1;
		char last = c[0];
		int count = 1;
		for (int i = 1; i < n; i++) {
			if (c[i] != last) {
				count++;
			} else {
				max = Math.max(max, count);
				count = 1;
			}
			last = c[i];
		}
		max = Math.max(max, count);
		int[] dpl = new int[n];
		int[] dpr = new int[n];
		dpl[0] = 1;
		dpr[n - 1] = 1;
		count = 1;
		last = c[0];
		boolean flag = true;
		for (int i = 1; i < n; i++) {
			if (c[i] != last && flag) {
				count++;
				dpl[i] = count;
			} else {
				flag = false;
				dpl[i] = dpl[i - 1];
				count = 1;
			}
			last = c[i];
		}

		flag = true;
		last = c[n - 1];
		count = 1;
		for (int i = n - 2; i >= 0; i--) {
			if (c[i] != last && flag) {
				count++;
				dpr[i] = count;
			} else {
				flag = false;
				dpr[i] = dpr[i + 1];
				count = 1;
			}
			last = c[i];
		}

		// System.out.println(Arrays.toString(dpl));
		// System.out.println(Arrays.toString(dpr));
		if (c[0] == c[n - 1]) {
			System.out.println(max);
		} else {
			for (int i = 1; i < n - 1; i++) {
				max = Math.max(max, dpl[i] + dpr[i + 1]);
			}
			System.out.println(max);
		}

		out.close();
	}

	private static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

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

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			long sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		static boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return readString();
		}
	}

	private static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(outputStream);
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void printLine(Object... objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}
	}
}