import java.io.*;
import java.util.*;

public class tesseract_pk_wa {

	void solve() throws IOException {
		String s = nextToken();
		int n = s.length();
		int[] odd = new int[n];
		odd[0] = 1;
		int c = 0;
		int r = 0;
		for (int i = 1; i < n; i++) {
			odd[i] = 1;
			if (i < r) {
				odd[i] = Math.min(r - i + 1, odd[c * 2 - i]);
			}
			while (i - odd[i] >= 0 && i + odd[i] < n
					&& s.charAt(i - odd[i]) == s.charAt(i + odd[i]))
				odd[i]++;
			if (i + odd[i] - 1 > r) {
				c = i;
				r = i + odd[i] - 1;
			}
		}
		//System.err.println(s);
		//System.err.println(Arrays.toString(odd));
		int[] even = new int[n];
		even[0] = 0;
		c = -1;
		r = -1;
		for (int i = 0; i < n - 1; i++) {
			if (i < r) {
				even[i] = Math.min(r - i - 1, even[2 * c - i + 1]);
			}
			while (i - even[i] >= 0 && i + even[i] + 1 < n
					&& s.charAt(i - even[i]) == s.charAt(i + even[i] + 1)) {
				even[i]++;
			}
			if (i + even[i] > r) {
				r = i + even[i];
				c = i;
			}
		}
		//System.err.println(Arrays.toString(even));
		ArrayList<Range> ranges = new ArrayList<tesseract_pk_wa.Range>();
		for (int i = 0; i < n; i++) {
			ranges.add(new Range(i - odd[i] + 1, i + odd[i] - 1));
			if (even[i] > 0) {
				ranges.add(new Range(i - even[i] + 1, i + even[i]));
			}
		}
		Collections.sort(ranges);
		//System.err.println(ranges.toString());
		int rightest = -1;
		long ans = 0;
		for (Range x : ranges) {
			ans = ans + x.length / 2 + x.length % 2 - 1;
			if (rightest >= x.right)
				ans++;
			rightest = Math.max(rightest, x.right);
			//System.err.print(ans + " ");
		}
		out.println(ans);
	}

	class Range implements Comparable<Range> {
		int left, right, length;

		@Override
		public int compareTo(Range arg0) {
			if (left != arg0.left)
				return left - arg0.left;
			return -right + arg0.right;
		}

		public Range(int left, int right) {
			super();
			this.left = left;
			this.right = right;
			length = right - left + 1;
		}

		@Override
		public String toString() {
			return "Range [left=" + left + ", right=" + right + "]";
		}
		
		
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;

	void run() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);

			br = new BufferedReader(new FileReader(new File("tesseract.in")));
			out = new PrintWriter("tesseract.out");

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		new tesseract_pk_wa().run();
	}

	String nextToken() throws IOException {
		while ((st == null) || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}

	double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}

	long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(nextToken());
	}
}
