func_code_string: #include <bits/stdc++.h>   inline void cmin(int &a, int b) {     if (b < a) a = b;   }   int a[1000005], f[1 << 21];   int main() {     int n, i, now, ans, l, j, k;     char s[22];     for (scanf( %d , &n), i = 0; i < n; i++) {       scanf( %s , s);       for (a[i] = j = 0; s[j]; j++) a[i] = (a[i] << 1) + s[j] -  0 ;     }     memset(f, 1, sizeof f);     for (f[0] = 0, ans = l = strlen(s), i = 1; i < n; i++) {       for (k = 0; (a[i - 1] & (1 << l - k) - 1) != (a[i] >> k); k++)         ;       ans += k;       for (now = 1 << 25, j = 0; j <= l; j++)         cmin(now, f[(1 << l - j) - 1 + (a[i] >> j)] + j);       for (now -= k, j = 0; j <= l; j++)         cmin(f[(1 << j) - 1 + (a[i - 1] & (1 << j) - 1)], now);     }     for (now = i = 0; i < 1 << 21; i++) cmin(now, f[i]);     printf( %d n , ans + now);     return 0;   }   