func_code_string: #include <bits/stdc++.h>   using namespace std;   string s[100];   long long C[51][3000][2];   int Count[2000100];   double DP[2000100];   int l;   double get(int mask) {     int left = Count[mask];     if (left == 0) return 0;     if (DP[mask] >= 0) return DP[mask];     double res = 0;     int cnt = 0;     for (int i = 0; i < l; i++)       if ((mask & (1 << i)) == 0) {         res += left + Count[mask | (1 << i)] * get(mask | (1 << i));         cnt++;       }     return DP[mask] = res / cnt / left;   }   int main() {     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> s[i];     l = s[0].size();     int h1 = l / 2;     int h2 = l - l / 2;     for (int j = 0; j < n; j++)       for (int i = 0; i < (1 << h1); i++) {         long long c = 0;         for (int k = 0; k < n; k++) {           if (k != j) {             int common = 0;             for (int m = 0; m < h1; m++)               if (s[j][m] == s[k][m]) common |= 1 << m;             if ((i & common) == i) c |= 1ll << k;           }         }         C[j][i][0] = c;       }     for (int j = 0; j < n; j++)       for (int i = 0; i < (1 << h2); i++) {         long long c = 0;         for (int k = 0; k < n; k++) {           if (j != k) {             int common = 0;             for (int m = 0; m < h2; m++)               if (s[j][m + h1] == s[k][m + h1]) common |= 1 << m;             if ((i & common) == i) c |= 1ll << k;           }         }         C[j][i][1] = c;       }     int mask = (1 << h1) - 1;     for (int i = 0; i < (1 << l); i++) {       int cnt = 0;       for (int j = 0; j < n; j++) {         long long common = C[j][mask & i][0] & C[j][i >> h1][1];         if (common != 0) cnt++;       }       Count[i] = cnt;     }     for (int i = 0; i < (1 << l); i++) DP[i] = -1.0;     printf( %.15llf n , get(0));   }   