#include<iostream> #include<cstring> #define maxn 1000010 #define ll long long usingnamespacestd;
constint p = 998244353; inlineintadd(int x, int y){ return (x += y) >= p ? x - p : x; } inlineintmul(int x, int y){ return1ll * x * y % p; } inlineintadd(initializer_list<int> lst){ int s = 0; for (auto t : lst) s = add(s, t); return s; }
int n; char s[maxn];
structPAM { int l, nxt[26], fail; } T[maxn]; int top, last; voidinit_PAM(){ top = 1; last = 0; T[0].l = 0; T[0].fail = 1; T[1].l = -1; T[1].fail = -1; }
inlineintget(int i, int u){ while (s[i - T[u].l - 1] != s[i]) u = T[u].fail; return u; }
int f[maxn][3], g[maxn]; intinsert(int i, int ch){ int p = get(i, last); if (!T[p].nxt[ch]) { int q = ++top; T[q].l = T[p].l + 2; T[q].fail = T[get(i, T[p].fail)].nxt[ch]; T[p].nxt[ch] = q;
cin >> s + 1; n = strlen(s + 1); init_PAM(); int ans = 0; for (int i = 1; i <= n; ++i) ans = add(ans, g[insert(i, s[i] - 'a')]); cout << ans << "\n"; return0; }