import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.IOException; import java.util.InputMismatchException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author lewin */ public class ketek_counting_lewin { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); OutputWriter out = new OutputWriter(outputStream); ketekcounting solver = new ketekcounting(); solver.solve(1, in, out); out.close(); } static class ketekcounting { int mod = 998244353; int c1; int c2; char[] c; long[] dp; public int getMult(char a, char b) { if (a == '?' && b == '?') return 26; if (a == '?' || b == '?') return 1; return (a == b) ? 1 : 0; } public void solve(int testNumber, InputReader in, OutputWriter out) { String s = in.next(); int mult = 1; if (s.length() % 2 == 1) { if (s.charAt(s.length() / 2) == '?') mult = 26; s = s.substring(0, s.length() / 2) + s.substring(s.length() / 2 + 1); } c = s.toCharArray(); int t = c.length / 2; c1 = c.length / 2 - 1; c2 = c1 + 1; dp = new long[t + 1]; dp[0] = 1; long cf = 1; for (int i = 0; i < t; i++) { cf = cf * getMult(c[c1 - i], '?') * getMult(c[c2 + i], '?') % mod; dp[i + 1] = cf; } for (int i = 0; i < t; i++) { expand(c1 - i, c1 - i, c2 + i, c2 + i); expand(c1 - i - 1, c1 - i, c2 + i, c2 + i + 1); } out.println(dp[t] * mult % mod); } boolean in_range(int x) { return 0 <= x && x < c.length; } void expand(int a1, int a2, int b1, int b2) { if (!in_range(a1) || !in_range(a2) || !in_range(b1) || !in_range(b2)) return; long cf = getMult(c[a1], c[b1]); if (a2 != a1) cf = cf * getMult(c[a2], c[b2]) % mod; do { dp[b2 - c2 + 1] = (dp[b2 - c2 + 1] + dp[b1 - c2] * cf) % mod; } while (in_range(--a1) && in_range(++a2) && in_range(--b1) && in_range(++b2) && a2 < b1 && (cf = cf * getMult(c[a1], c[b1]) * getMult(c[a2], c[b2]) % mod) > 0); } } static class OutputWriter { private final PrintWriter writer; public OutputWriter(OutputStream outputStream) { writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter(Writer writer) { this.writer = new PrintWriter(writer); } public void close() { writer.close(); } public void println(long i) { writer.println(i); } } static class InputReader { private InputStream stream; private byte[] buf = new byte[1 << 16]; private int curChar; private int numChars; public InputReader(InputStream stream) { this.stream = stream; } public int read() { if (this.numChars == -1) { throw new UnknownError(); } else { if (this.curChar >= this.numChars) { this.curChar = 0; try { this.numChars = this.stream.read(this.buf); } catch (IOException var2) { throw new InputMismatchException(); } if (this.numChars <= 0) { return -1; } } return this.buf[this.curChar++]; } } public String next() { int c; while (isSpaceChar(c = this.read())) { ; } StringBuilder result = new StringBuilder(); result.appendCodePoint(c); while (!isSpaceChar(c = this.read())) { result.appendCodePoint(c); } return result.toString(); } public static boolean isSpaceChar(int c) { return c == 32 || c == 10 || c == 13 || c == 9 || c == -1; } } }