import std.stdio; import std.array; import std.string; import std.conv; import std.algorithm; import std.typecons; import std.range; import std.random; import std.math; import std.container; import std.numeric; import std.bigint; import core.bitop; alias Tuple!(int, "l", int, "r") kaibun; string S; int N; bool is_kaibun(int l, int r) { foreach (i; 0..(r-l+1)/2) if (S[l+i] != S[r-i]) return false; return true; } void main() { S = readln.chomp; N = S.length.to!int; kaibun[] P1; foreach (i; 0..N) if (is_kaibun(0, i)) P1 ~= kaibun(0, i); kaibun[] P3; foreach (i; 0..N) if (is_kaibun(i, N-1)) P3 ~= kaibun(i, N-1); int ans = 0; foreach (p1; P1) foreach (p3; P3) { if (p3.l - p1.r <= 2) continue; foreach (i; p1.r+1..p3.l-1) if (is_kaibun(p1.r+1, i)) ans++; } ans.writeln; }