A string is a palindrome if it reads the same from the left to the right and from the right to the left. For example, the strings "kek", "abacaba", "r" and "papicipap" are palindromes, while the strings "abb" and "iq" are not.

A substring s[l … r] (1 ≤ l ≤ r ≤ |s|) of a string s = s_{1}s_{2} … s_{|s|} is the string s_{l}s_{l + 1} … s_{r}.

Anna does not like palindromes, so she makes her friends call her Ann. She also changes all the words she reads in a similar way. Namely, each word s is changed into its longest substring that is not a palindrome. If all the substrings of s are palindromes, she skips the word at all.

Some time ago Ann read the word s. What is the word she changed it into?

Input

The first line contains a non-empty string s with length at most 50 characters, containing lowercase English letters only.

Output

If there is such a substring in s that is not a palindrome, print the maximum length of such a substring. Otherwise print 0.

Note that there can be multiple longest substrings that are not palindromes, but their length is unique.

Examples

Input

mew


Output

3


Input

wuffuw


Output

5


Input

qqqqqqqq


Output

0

Note

"mew" is not a palindrome, so the longest substring of it that is not a palindrome, is the string "mew" itself. Thus, the answer for the first example is 3.

The string "uffuw" is one of the longest non-palindrome substrings (of length 5) of the string "wuffuw", so the answer for the second example is 5.

All substrings of the string "qqqqqqqq" consist of equal characters so they are palindromes. This way, there are no non-palindrome substrings. Thus, the answer for the third example is 0.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.math.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.util.List.*;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.Stream;


public class Main {

	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		// ApplicationContext con = new
		// ClassPathXmlApplicationContext("bean.xml");
		FastReader in = new FastReader();
		StringBuilder out = new StringBuilder();
		/*
		 * ApplicationContext context = new
		 * ClassPathXmlApplicationContext("spring.xml");
		 * 
		 * Student student = (Student)
		 * context.getBean("studentbean",Student.class); student.displayInfo();
		 */
		String s = in.next();
		int c1 = 0;
		int c2 = 1;
		String r = "" + s.charAt(0);
		for (int i = 1; i < s.length(); i++) {
			r += s.charAt(i);
			out = new StringBuilder(r);
			if (!r.equals(out.reverse().toString())) {
				c2++;
				c1 = Math.max(c1, c2);
			} else {
				c2++;
			}

		}
		System.out.println(c1);
	}

}

class Node {

	int data;
	Node left, right;

	Node(int d) {
		data = d;
		left = right = null;
	}
}

class BinaryTree {

	static Node head;
	Node root;

	/*
	 * Given a binary search tree and a number, inserts a new node with the
	 * given number in the correct place in the tree. Returns the new root
	 * pointer which the caller should then use (the standard trick to avoid
	 * using reference parameters).
	 */
	Node insert(Node node, int data) {

		/*
		 * 1. If the tree is empty, return a new, single node
		 */
		if (node == null) {
			return (new Node(data));
		} else {

			/* 2. Otherwise, recur down the tree */
			if (data <= node.data) {
				node.left = insert(node.left, data);
			} else {
				node.right = insert(node.right, data);
			}

			/* return the (unchanged) node pointer */
			return node;
		}
	}

	/*
	 * Given a non-empty binary search tree, return the minimum data value found
	 * in that tree. Note that the entire tree does not need to be searched.
	 */
	int minValue(Node node) {
		Node current = node;

		/* loop down to find the leftmost leaf */
		while (current.left != null) {
			current = current.left;
		}
		return (current.data);
	}

	public int maxValue(Node node) {
		Node cur = node.right;
		while (cur.right != null) {
			cur = cur.right;
		}
		return cur.data;
	}

	boolean isBST() {
		return isBSTUtil(root, Integer.MIN_VALUE, Integer.MAX_VALUE);
	}

	public boolean isBSTUtil(Node node, int min, int max) {
		if (node == null) {
			return true;
		}
		if (node.data < min || node.data > max) {
			return false;
		}
		return (isBSTUtil(node.left, min, node.data - 1) && isBSTUtil(node.right, node.data + 1, max));
	}
}

class FastReader {

	BufferedReader br;
	StringTokenizer st;

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

	}

	public String next() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());

			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

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

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

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

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