func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mod = 51123987;   int f[160][53][53][53];   int n, m, ans, a[160][3];   char s[160];   void up(int &a, int b) {     a += b;     a %= mod;   }   int main() {     scanf( %d n%s , &n, s);     a[n][0] = a[n][1] = a[n][2] = n;     for (int i = n - 1; i >= 0; i--) {       a[i][0] = a[i + 1][0];       a[i][1] = a[i + 1][1];       a[i][2] = a[i + 1][2];       a[i][s[i] -  a ] = i;     }     f[0][0][0][0] = 1;     m = (n + 2) / 3;     for (int i = 0; i < n; i++)       for (int j = 0; j <= m; j++)         for (int k = 0; k <= m; k++)           for (int l = 0; l <= m; l++) {             int g = f[i][j][k][l];             if (j + k + l == n && abs(j - k) < 2 && abs(k - l) < 2 &&                 abs(l - j) < 2)               up(ans, g);             up(f[a[i][0]][j + 1][k][l], g);             up(f[a[i][1]][j][k + 1][l], g);             up(f[a[i][2]][j][k][l + 1], g);           }     cout << ans;     return 0;   }   