func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   inline T updmax(T& a, T b) {     return a = max(a, b);   }   template <class T>   inline T updmin(T& a, T b) {     return a = min(a, b);   }   class Solution {    public:     void solve() {       long long n;       string s;       cin >> n >> s;       vector<int> a(n, 0);       vector<int> cnt(n, 0);       int x = 0;       long long ret = (n * (n + 1)) / 2 - n;       for (int i = 0; i < n; i++) {         a[i] = x;         cnt[x]++;         if (i == n - 1 || s[i] != s[i + 1]) x++;       }       if (x != 1) {         for (int i = 0; i < x; i++) {           if (i == 0 || i == x - 1)             ret -= cnt[i];           else             ret -= 2 * cnt[i];         }         ret += x - 1;       }       cout << ret <<   n ;       return;     };   };   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     Solution solution;     solution.solve();     return 0;   }   