func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k, mod = 1000000007;   bool ok[1005];   char a[1005], b[1005];   int cnt[2][1005], tp, tn;   int solve() {     scanf( %s , a);     scanf( %s , b);     n = strlen(a);     scanf( %d , &k);     int cg = 0;     for (int i = 0; i < n; i++) {       ok[i] = true;       for (int j = 0; j < n && ok[i]; j++)         if (a[j] != b[(i + j) % n]) ok[i] = false;       cg += ok[i];     }     if (!cg) return 0;     cnt[1][0] = 1;     tp = 1;     for (int s = 0; s < k; s++) {       tn = 0;       int p = (s + 1) % 2, c = s % 2;       for (int i = 0; i < n; i++) {         cnt[c][i] = (tp + mod - cnt[p][i]) % mod;         tn = (tn + cnt[c][i]) % mod;       }       tp = tn;     }     int re = 0;     for (int i = 0; i < n; i++)       if (ok[i]) {         re = (re + cnt[(k + 1) % 2][i]) % mod;       }     return re;   }   int main() { printf( %d n , solve()); }   