func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long M = 998244353;   long long modpow(long long base, long long exp, long long modulus = M) {     base %= modulus;     long long result = 1;     while (exp > 0) {       if (exp & 1) result = (result * base) % modulus;       base = (base * base) % modulus;       exp >>= 1;     }     return result;   }   long long modinv(long long a, long long mod = M) { return modpow(a, mod - 2); }   string s;   int n;   long long f[1000010], invf[1000010];   long long C(long long a, long long b) {     if (b > a || b < 0 || a < 0) return 0;     return (((f[a] * invf[b]) % M) * invf[a - b]) % M;   }   int main() {     ios::sync_with_stdio(false);     cin >> s;     n = s.length();     f[0] = invf[0] = 1;     for (int i = 1; i <= n; ++i) {       f[i] = (f[i - 1] * i) % M;       invf[i] = modinv(f[i]);     }     int lb = 0, rb = 0, lq = 0, rq = 0;     for (int i = 0; i < n; ++i) {       if (s[i] ==  ) )         ++rb;       else if (s[i] ==  ? )         ++rq;     }     long long ans = 0;     for (int i = 0; i < n; ++i) {       if (s[i] ==  ) ) --rb;       if (s[i] ==  ( ) ++lb;       if (s[i] ==  ? ) --rq, ++lq;       ans += (1ll * lb * C(lq + rq, rq - lb + rb) +               1ll * lq * C(lq + rq - 1, rq - lb + rb - 1)) %              M;       ans %= M;     }     cout << ans << endl;     return 0;   }   